Your First Script

From an empty tab to a script that reads the game, changes something, and prints it out.

Hello, world

Open a new tab, paste this in, 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 shows up in the console under the editor. print and warn both go there, and so does anything the game prints.

Changing something

Since your script runs inside Roblox, everything you know about the Roblox API works. There's nothing special for the character, it's 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

If you hit Execute at the exact wrong moment your character might not exist yet. Character or CharacterAdded:Wait() handles that, and does nothing if the character's already there.

Thread identity

Your script runs at a higher identity than normal game scripts, which is why it can touch things they can't. getthreadidentity tells you what you're at, and setthreadidentity changes it. Usually you'd go *down* so the 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 goes into identity properly, including which levels unlock which properties.

What next

The Editor

Tabs, the file explorer, the console and the shortcuts worth knowing.

Workspace & Auto-Execute

Where your files are and how to make a script run as soon as you join.

Closures

Hooking is probably the most useful thing the executor gives you. Start there once you're comfortable with the basics.

Guides

Longer walkthroughs: a remote spy, a Drawing ESP, and running code inside actors.