Vector3Value

Hold a 3D position or direction in the tree.

Value is a Vector3, all zeros by default, and takes only a Vector3. A Vector3 written in the project file is saved exactly as written. Each change fires Changed with the new vector.

Made with Instance.new("Vector3Value") or Clone().

Example

Read a pointShotScript
-- A Vector3Value holds a Vector3. Settings.Spawn is one, saved in the project as Vector3(0, 3, 4).
local spawn = root.Settings.Spawn
local at = spawn.Value
print("Spawn: X " .. at.X .. ", Y " .. at.Y .. ", Z " .. at.Z .. ", Magnitude " .. at.Magnitude)

local copy = Instance.new("Vector3Value")
print("a new Vector3Value: X " .. copy.Value.X .. ", Y " .. copy.Value.Y .. ", Z " .. copy.Value.Z)
copy.Changed:Connect(function(point : Vector3)
	print("the copy changed, the same point as Spawn: " .. tostring(point == at))
end)
copy.Value = at
What it printedOutput
Spawn: X 0, Y 3, Z 4, Magnitude 5
a new Vector3Value: X 0, Y 0, Z 0
the copy changed, the same point as Spawn: true

Properties

NameTypeDefaultDescription
ValueVector3"Vector3 0, 0, 0"The vector it holds; each change fires Changed with the new vector, and anything but a Vector3 errors.
From ShotInstance 33