Roblox Lua Cheat Sheet
A one-page printable reference for Roblox data types, instance methods, properties, events, remote events, services and the most-used Lua patterns. Pin it next to your monitor!
A one-page printable reference for Roblox data types, instance methods, properties, events, remote events, services and the most-used Lua patterns. Pin it next to your monitor!
| Instance | Base object for all game objects |
| Vector3 | 3D vector (x, y, z) |
| Vector2 | 2D vector (x, y) |
| CFrame | Position + rotation combined |
| Color3 | RGB colour (0-1 range) |
| BrickColor | Named colour palette |
| Enum | Enumerated constants |
| UDim2 | UI scale + offset (pixels + scale) |
| UDim | Single scale + offset |
| Ray | Origin + direction for raycasting |
| Enum.EasingStyle | Linear, Sine, Quad, Cubic, etc. |
| Instance.new("ClassName") | Create a new instance |
| :FindFirstChild("Name") | Find child or nil |
| :GetFirstChild("Name") | Find child or error |
| :GetChildren() | Array of all children |
| :GetDescendants() | All nested children |
| :Clone() | Deep copy of instance |
| :Destroy() | Remove from game |
| :WaitForChild("Name") | Wait then find child |
| :GetService("Name") | Get/create a service |
| :IsA("ClassName") | Check class type |
| :GetAttribute("Key") | Read custom attribute |
| :SetAttribute("Key", val) | Write custom attribute |
| .Name | Instance name |
| .Parent | Parent in hierarchy |
| .Position | World position (Vector3) |
| .Size | Dimensions (Vector3) |
| .Color | BrickColor value |
| .Transparency | 0 (opaque) to 1 (invisible) |
| .Anchored | Static in world (no physics) |
| .CanCollide | Can other parts collide with it |
| .CFrame | Position + orientation |
| .Massless | Zero mass in assembly |
| .Material | Plastic, Wood, Neon, etc. |
| Touched | Part collision begin |
| TouchEnded | Part collision end |
| Changed | Property changed |
| ChildAdded | New child inserted |
| ChildRemoved | Child removed |
| DescendantAdded | Any nested child added |
| MouseClick (ClickDetector) | Player clicked part |
| Triggered (ProximityPrompt) | Player interacted |
| Activated (GuiButton) | UI button clicked |
| Heartbeat | Every frame (RunService) |
| Stepped | Before physics step |
โโ SERVER SCRIPT โโ local remote = Instance.new("RemoteEvent") remote.Name = "DamageEvent" remote.Parent = ReplicatedStorage remote.OnServerEvent:Connect( function(player, amount) -- player = who fired it end ) โโ LOCAL SCRIPT โโ remote.FireServer(10) โโ SERVER BROADCAST โโ remote.FireClient(targetPlayer, data) remote.FireAllClients(data) โโ REMOTE FUNCTION (request/response) โโ -- Server: func.OnServerInvoke = function(player) return {gold = 50} end -- Client: local data = func.InvokeServer()
| game.Players | Players service |
| player.Character | Character model |
| player.CharacterAdded | Character respawn event |
| player:LoadCharacter() | Force respawn |
| player.UserId | Unique player ID |
| player.Name | Display name |
| player.Team | Current team |
| player.CharacterAppearanceId | Avatar look ID |
-- Get character parts local char = player.Character local hrp = char:WaitForChild("HumanoidRootPart") local hum = char:WaitForChild("Humanoid") -- Auto-load on join Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) -- setup code here end) end)
| Workspace | All physical parts in game |
| Players | Player management |
| ReplicatedStorage | Shared client/server data |
| ServerStorage | Server-only data |
| ServerScriptService | Server scripts only |
| Lighting | Environment and lighting |
| RunService | Frame updates (Heartbeat) |
| UserInputService | Keyboard/mouse/touch |
| TweenService | Smooth property animation |
| Debris | Auto-destroy after time |
| SoundService | Global audio |
| StarterGui | Player GUI container |
| StarterPack | Tools given on spawn |
| Vector3.new(x, y, z) | Create 3D vector |
| CFrame.new(pos) | CFrame at position |
| CFrame.Angles(rx, ry, rz) | CFrame with rotation |
| math.random(min, max) | Random integer |
| math.floor(n) | Round down |
| math.ceil(n) | Round up |
| math.clamp(n, min, max) | Restrict to range |
| math.abs(n) | Absolute value |
| math.sqrt(n) | Square root |
| math.rad(deg) | Degrees to radians |
โโ PLAYER MOVEMENT โโ local UIS = game:GetService("UserInputService") local speed = 16 game.RunService.Heartbeat:Connect(function() local char = player.Character if not char then return end local hrp = char:FindFirstChild("HumanoidRootPart") local hum = char:FindFirstChild("Humanoid") if hum then hum.WalkSpeed = speed end end) โโ LEADERSTATS โโ game.Players.PlayerAdded:Connect(function(player) local ls = Instance.new("Folder") ls.Name = "leaderstats" ls.Parent = player local coins = Instance.new("IntValue") coins.Name = "Coins" coins.Value = 0 coins.Parent = ls end) โโ DATA STORE โโ local DS = game:GetService("DataStoreService") local store = DS:GetDataStore("SaveData") game.Players.PlayerAdded:Connect(function(player) local key = "player_" .. player.UserId local data = store:GetAsync(key) end) game.Players.PlayerRemoving:Connect(function(player) local key = "player_" .. player.UserId store:SetAsync(key, {coins = 100}) end) โโ SHOP SYSTEM โโ local deb = false part.Touched:Connect(function(hit) if deb then return end local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and plr.leaderstats.Coins.Value >= 50 then plr.leaderstats.Coins.Value -= 50 -- give item deb = true task.wait(1) deb = false end end) โโ TWEEN SERVICE โโ local ts = game:GetService("TweenService") local info = TweenInfo.new(1, Enum.EasingStyle.Quad) local tween = ts:Create(part, info, { Position = part.Position + Vector3.new(0, 10, 0) }) tween:Play()
Follow one of our free step-by-step workshops in the Workshop hub.
๐ง Browse Workshops โ