World Executor · Roblox VM

Your First Script

From an empty editor tab to a script that reads the game, changes it, and prints somewhere you can see.

Hello, world

Open a new tab in the editor, paste this, and press Execute.

hello.lua
print("hello from " .. identifyexecutor())

local Players = game:GetService("Players")
local me = Players.LocalPlayer

print("playing as", me.Name)
print("place id", game.PlaceId)

Output lands in the console pane under the editor. print and warn both go there, and so does anything the game itself prints.

Changing something

Because your script runs inside Roblox, everything you already know about the Roblox API applies. There is no special accessor for the character — it is just the instance tree.

speed.lua
local Players = game:GetService("Players")
local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

humanoid.WalkSpeed = 60
humanoid.JumpPower = 100

-- Walk back to normal after ten seconds.
task.delay(10, function()
    humanoid.WalkSpeed = 16
    humanoid.JumpPower = 50
end)

Wait for the character

Scripts fired the instant you press Execute can beat the character into existence. Character or CharacterAdded:Wait() is the standard guard and costs nothing when the character is already there.

Thread identity

Your script runs at an elevated identity, which is what lets it touch things a normal game script cannot. getthreadidentity tells you where you stand, and setthreadidentity moves you — usually to drop *down* so that a game's own checks see what they expect.

identity.lua
print(getthreadidentity())   --> 8, executor identity

-- Some games check identity before trusting a caller. Drop to 2
-- (a normal script) for the duration of the call, then go back.
local previous = getthreadidentity()
setthreadidentity(2)
local ok = pcall(function()
    return game:GetService("Players").LocalPlayer.Backpack:GetChildren()
end)
setthreadidentity(previous)

The Reflection chapter covers identity in full, including which levels unlock which properties.

Where to go next

The Editor

Tabs, the file explorer, the console pane and every shortcut worth learning.

Workspace & Auto-Execute

Where your files live on disk and how to make a script run the moment you join a game.

Closures

Hooking is the single most useful thing the executor gives you. Start there once the basics are comfortable.

Guides

Longer walkthroughs: a remote spy, a Drawing ESP, parallel work with actors.