Vector2Value class stores a single Vector2 value (2D coordinates), extending from Class.Value. It's designed for synchronizing 2D position or direction data across all clients in a networked environment, such as UI positions, 2D game coordinates, or directional input. IMPORTANT: Values should be changed on the server side. The Changed event should be connected on the client side to receive updates. NOTE: You can optionally pass a player object as the third parameter to associate the value with a specific player. Alternatively, you can concatenate the player ID to the name: "ValueName" .. tostring(player.id)
Properties
Represents the synchronized Vector2 value. Changes trigger notifications across clients via the Value.Changed event.
local position = Vector2Value.new("Position", Vector2.new(10, 20))
position.value = Vector2.new(15, 25) -- Syncs to all clients
print("X: " .. position.value.x .. " Y: " .. position.value.y)
Updated 13 days ago