Instances
game (the DataModel) and workspace are instance proxies backed by live game memory. Property reads and method calls go straight to Roblox's own objects.
Globals & creation
Live proxies to the DataModel and Workspace. game.PlaceId, game.GameId and game.JobId are supported.
print(game.PlaceId, game.JobId)
print(workspace.CurrentCamera)
Creates an instance through Roblox's own class registry (with a creatability check) and optionally parents it. Returns nil and logs a reason on failure (class not found, not creatable, etc.).
local part = Instance.new("Part", workspace)
part.Name = "MyPart"
part.Position = Vector3.new(0, 10, 0)
Methods
Direct children, or the full descendant tree.
for _, child in ipairs(workspace:GetChildren()) do
print(child.Name)
end
print(#workspace:GetDescendants())
First matching child, or nil.
print(workspace:FindFirstChild("Map"))
print(workspace:FindFirstChildOfClass("Model"))
print(workspace:FindFirstChildWhichIsA("BasePart"))
First matching ancestor, or nil.
local part = workspace:FindFirstChildWhichIsA("BasePart")
if part then
print(part:FindFirstAncestorOfClass("Model"))
print(part:FindFirstAncestorWhichIsA("Model"))
end
Walks up the parent chain and returns the first ancestor whose Name matches.
local part = workspace.Model.Part
print(part:FindFirstAncestor("Model"))
Destroys every direct child of the instance.
workspace.Folder:ClearAllChildren()
Yields until the child exists (or times out).
local target = workspace:WaitForChild("Map", 5)
print(target)
Class checks understand common hierarchies (BasePart, Model, GuiObject, ValueBase, LuaSourceContainer, Tool, …).
local part = workspace:FindFirstChildWhichIsA("BasePart")
if part then
print(part:IsA("BasePart"), part:IsDescendantOf(workspace))
end
Reads/writes instance attributes.
workspace:SetAttribute("Mode", "test")
print(workspace:GetAttribute("Mode"))
for name, value in pairs(workspace:GetAttributes()) do
print(name, value)
end
Finds a top-level service by class name.
local players = game:GetService("Players")
print(players)
All current players (from the Players service).
for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
print(player.Name)
end
Fires when the given property changes.
workspace:GetPropertyChangedSignal("Name"):Connect(function()
print("workspace renamed")
end)
Projects a world position through the camera. Returns (x, y, depth) in screen space plus true when on screen.
local cam = workspace.CurrentCamera
local pos, visible = cam:WorldToViewportPoint(target.Position)
if visible then
print(math.floor(pos.X), math.floor(pos.Y), pos.Z)
end
Pivot of a Model (uses its PrimaryPart).
local model = workspace:FindFirstChildWhichIsA("Model")
print(model and model:GetPivot())
Removes the instance by unparenting it.
local part = Instance.new("Part", workspace)
part:Destroy()
Equips a Tool on a character through the game's own bound functions.
local character = game:GetService("Players").LocalPlayer.Character
local tool = Instance.new("Tool")
tool.Parent = character
character:EquipTool(tool)
character:UnequipTools()
Fires a BindableEvent (any arguments) or a ProximityPrompt (defaults the player argument to the local player).
local event = Instance.new("BindableEvent")
event.Event:Connect(function(value)
print(value)
end)
event.Event:Fire("hello")
Fires a RemoteEvent or UnreliableRemoteEvent through Roblox's native serializer. Supports booleans, numbers, strings, Instances and Vector3 arguments.
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
remote:FireServer("Hello", 123, true, Vector3.new(0, 10, 0), workspace)
Properties
| Class | Readable | Writable |
|---|---|---|
| Any | Name, ClassName, Parent, Address | Parent (set to nil to unparent) |
| DataModel | PlaceId, GameId, JobId, Workspace | — |
| Players | LocalPlayer | — |
| Player | Character, DisplayName, UserId, Team, Mouse, GetMouse() | — |
| Workspace | CurrentCamera | — |
| BasePart | Position, CFrame | Position, CFrame, Size, Transparency, Anchored, Velocity/AssemblyLinearVelocity, CanCollide, Color |
| Humanoid | Health | Health, MaxHealth, WalkSpeed, JumpPower, JumpHeight |
| Lighting | Brightness, ClockTime, FogStart, FogEnd, GlobalShadows, Ambient, OutdoorAmbient, FogColor | same as readable |
| Camera | FieldOfView | FieldOfView |
| Value objects | Value (Bool, Int, Number, String, Object, Vector3) | Value |
Signals exposed on instances
| Instance | Signal |
|---|---|
| Any | ChildAdded, ChildRemoved, DescendantAdded |
| Players | PlayerAdded, PlayerRemoving |
| Player | CharacterAdded |
| BindableEvent | Event |
| RemoteEvent / UnreliableRemoteEvent | OnClientEvent |
| ProximityPrompt | Triggered |
Hybrid interaction functions
These require the Hybrid Luau toggle and a focused game window.
Fires a ClickDetector from any distance. distance defaults to 0 and bypasses MaxActivationDistance; event may be "MouseClick" (default), "RightMouseClick", "MouseHoverEnter" or "MouseHoverLeave". Accepts either the ClickDetector or its parent BasePart.
local detector = workspace:FindFirstChildWhichIsA("ClickDetector", true)
if detector then
fireclickdetector(detector)
end
Forces a ProximityPrompt to begin and complete immediately, bypassing hold duration and activation distance. The engine hold path is tried first with a part-move fallback.
local prompt = workspace:FindFirstChildWhichIsA("ProximityPrompt", true)
if prompt then
fireproximityprompt(prompt)
end
Starts (state 0) or ends (state 1) a touch between two BaseParts, producing the engine's Touched and TouchEnded events. The target is overlapped until state 1 restores it. firetouch and firetouchtransmitter are aliases.
local player = game.Players.LocalPlayer
local hrp = player.Character.HumanoidRootPart
local coin = workspace.Coin
firetouch(hrp, coin, 0)
task.wait()
firetouch(hrp, coin, 1)
Alias of firetouchinterest for scripts that expect the shorter executor name.
firetouch(hrp, coin, 0)
task.wait()
firetouch(hrp, coin, 1)
Calls the instance's own InputHold bound functions through the call gate and returns whether the call succeeded. These are the primitives used internally by fireproximityprompt.
local prompt = workspace:FindFirstChildWhichIsA("ProximityPrompt", true)
if prompt then
prompt:InputHoldBegin()
task.wait(0.2)
prompt:InputHoldEnd()
end