All topics and tagsAbout

Scripting

Roblox games run on Luau, a fast version of Lua with type checking. These guides start with where a Script, LocalScript and ModuleScript belong, then move to events, leaderstats, saving with DataStores and talking between server and client with remote events.

If you prefer a real code editor, the Rojo guide shows how to write in VS Code and sync to Studio. If you use AI to write code, the script generator guide explains how to prompt for Luau and how to test what comes back, because AI code often looks right and still breaks in a live server.

Original illustration for the Scripting section: blocks on a workbench grid

5 guides in Scripting

A path through the scripting guides

Read the basics first

How to script in Roblox is the anchor. It names the language, Luau, and settles the question that confuses beginners most, where code goes: server code in a Script in ServerScriptService, client code in a Script with RunContext Client or a LocalScript in a starter container, and shared code in ModuleScripts in ReplicatedStorage. It then builds a kill brick, a points leaderboard, a RemoteEvent and a DataStore save.

Copy working code next

Once the layout makes sense, Roblox Studio scripts offers 13 short scripts, from a kill brick and leaderstats to doors, teleport pads, game pass checks and an obby checkpoint. It tells you where each one belongs and how to test with F5 and Shift+F5. Read the scripts before you paste them, and change one value at a time.

Add AI when you can judge the output

Roblox AI script generator compares four routes: Studio Assistant, Code Assist, Claude or Cursor through MCP, and a plain chatbot. Its main warning is that Code Assist and chatbots can suggest older APIs or plain Lua instead of Luau. Its checklist asks you to confirm that server code sits on the server, that RemoteEvent handlers validate what clients send, and that nothing calls require() with an asset ID you did not choose. Roblox Studio MCP shows how to connect an outside assistant.

Rojo is optional

Rojo is a community tool, not made by Roblox, and it syncs scripts to files so you can work in VS Code and Git. It cannot sync Terrain. You do not need it to use AI, since the built-in MCP server connects assistants straight to Studio.

Common stumbling blocks

DataStores do not work in Studio until the game is published and Enable Studio Access to API Services is turned on, ideally on a test copy. A LocalScript only affects one player, so anything that changes game state has to go through the server. Errors show in red in the Output window with a line number, which is the first place to look.

More topics