Properties
Vector3
|
The stored Vector3. |
bool
|
Determines if an |
string
[ReadOnly]
[NotReplicated]
|
A read-only string representing the class this |
int
[Hidden]
[ReadOnly]
[NotReplicated]
[Deprecated]
|
The cost of saving the instance using data persistence. |
string
|
A non-unique identifier of the |
Instance
[NotReplicated]
|
Determines the hierarchical parent of the |
bool
[Hidden]
|
A deprecated property that used to protect |
bool
[Hidden]
[NotReplicated]
[Deprecated]
|
string
[ReadOnly]
[NotReplicated]
[Deprecated]
|
Functions
void
|
This function destroys all of an |
Instance
|
Create a copy of an object and all its descendants, ignoring objects that are not |
void
|
Sets the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Variant
|
Returns the attribute which has been assigned to the given name |
RBXScriptSignal
|
Returns an event that fires when the given attribute changes |
Dictionary
|
Returns a dictionary of string → variant pairs for each of the |
Objects
|
Returns an array containing all of the |
string
[NotBrowsable]
|
Returns a coded string of the |
Array
[CustomLuaState]
|
Returns an array containing all of the descendants of the instance |
string
|
Returns a string describing the |
RBXScriptSignal
|
Get an event that fires when a given property of an object changes. |
bool
[CustomLuaState]
|
Returns true if an |
bool
|
Returns true if an |
bool
|
Returns true if an |
void
[Deprecated]
|
Sets the object’s Parent to nil, and does the same for all its descendants. |
void
|
Sets the attribute with the given name to the given value |
Instance
[CustomLuaState]
[CanYield]
|
Returns the child of the |
Objects
[Deprecated]
|
Returns an array of the object’s children. |
Instance
[Deprecated]
|
void
[Deprecated]
|
Instance
[Deprecated]
|
Objects
[Deprecated]
|
bool
[Deprecated]
[CustomLuaState]
|
bool
[Deprecated]
|
void
[Deprecated]
|
Events
RBXScriptSignal
|
Fired whenever |
RBXScriptSignal
[Deprecated]
|
RBXScriptSignal
|
Fires when the |
RBXScriptSignal
|
Fires whenever an attribute is changed on the |
RBXScriptSignal
|
Fired immediately after a property of an object changes. |
RBXScriptSignal
|
Fires when an object is parented to this |
RBXScriptSignal
|
Fires when a child is removed from this |
RBXScriptSignal
|
Fires when a descendant is added to the |
RBXScriptSignal
|
Fires immediately before a descendant of the |
RBXScriptSignal
[Deprecated]
|
Code Samples
Teleporter Part
This code sample causes a Part to teleport any players that touch it to a specific position defined by a “TeleportPosition” Vector3Value.
-- Paste me in a Script inside a Part local part = script.Parent -- A Vector3Value to hold the Teleport target position -- Tip: Prefix variables of "Value-" objects with "v" local vTeleportPosition = part.TeleportPosition local function onTouch(otherPart) -- First, find the HumanoidRootPart. If we can't find it, exit. local hrp = otherPart.Parent:FindFirstChild("HumanoidRootPart") if not hrp then return end -- Now teleport by setting the CFrame to one created from -- the stored in TeleportPosition hrp.CFrame = CFrame.new(vTeleportPosition.Value) end part.Touched:Connect(onTouch)
Storing Vector2 inside Vector3Value
This code sample demonstrates how it is possible to store a Vector2 within a Vector3Value by converting a Vector2 into a Vector3 with a dummy Z value. Similarly, you can load it by reconstructing the Vector2 from the X and Y axes.
local vector3Value = Instance.new("Vector3Value") -- Store a Vector2 in a Vector3 local vector2 = Vector2.new(42, 70) vector3Value.Value = Vector3.new(vector2.X, vector2.Y, 0) -- The Z value is ignored -- Load a Vector2 from a Vector3 local vector2 = Vector2.new(vector3Value.Value.X, vector3Value.Value.Y)