Properties
bool
|
Determines if an |
string
[ReadOnly]
[NotReplicated]
|
A read-only string representing the class this |
int
[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
|
A deprecated property that used to protect |
bool
[Hidden]
[NotReplicated]
[Deprecated]
|
string
[ReadOnly]
[NotReplicated]
[Deprecated]
|
Functions
void
|
Given a string name of a function and a priority, this method binds the function to |
bool
|
Returns whether the current environment is running on the client |
bool
|
Returns whether the current environment is in |
bool
|
Returns whether the ‘Run’ button has been pressed to run the simulation in Roblox Studio |
bool
|
Returns whether the game is currently running |
bool
|
Returns whether the current environment is running on the server |
bool
|
Returns whether the current environment is running in Roblox Studio |
void
|
Pauses the game’s simulation if it is running, suspending physics and scripts |
void
[Deprecated]
|
Resets the current game to a waypoint set when |
void
|
Runs the game’s simulation, running physics and scripts |
void
|
Ends the game’s simulation if it is running |
void
|
Unbinds a function that was bound to the render loop using |
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
[Deprecated]
|
Fires every frame after the physics simulation has completed |
RBXScriptSignal
|
RBXScriptSignal
|
RBXScriptSignal
|
RBXScriptSignal
|
RBXScriptSignal
[Deprecated]
|
Fires every frame prior to the frame being rendered |
RBXScriptSignal
[Deprecated]
|
Fires every frame prior to the physics simulation |
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
RunService Stepped
This code sample uses RunService’s Stepped event to create a Part that flies in a direction given a start position and speed. It uses a BodyPosition to move the Part, and calculates the new position of the Part each frame.
local RunService = game:GetService("RunService")
local PART_START_POS = Vector3.new(0, 10, 0)
local PART_SPEED = Vector3.new(10, 0, 0)
-- Create a Part with a BodyPosition
local part = Instance.new("Part")
part.CFrame = CFrame.new(PART_START_POS)
local bp = Instance.new("BodyPosition")
bp.Parent = part
bp.Position = PART_START_POS
part.Parent = workspace
local function onStep(currentTime, deltaTime)
-- Move the part the distance it is meant to move
-- in the last `deltaTime` seconds
bp.Position = bp.Position + PART_SPEED * deltaTime
-- Here's the math behind this:
-- speed = displacement / time
-- displacement = speed * time
end
RunService.Stepped:Connect(onStep)