Guides

Roblox scripting guides

Complete, working Luau for the systems Roblox developers build most, with where each script goes, why it is written that way and the errors you are likely to hit. Every guide works by hand. Popular first systems: a kill brick, coins to collect, a pet that follows you and daily rewards. New: how to make 26 kinds of game, from an obby and a horror game to tower defense, battlegrounds and an RNG game, plus a Steal a Brainrot style game, an admin panel and a drivable car. The building blocks most tutorials skip: key presses with UserInputService, press E prompts, TweenService, raycasting, debounce and cooldowns and developer products done safely. New to scripting? Start with how to script in Roblox Studio, then make your first game. RoCode, our Studio AI agent, is there if you would rather describe the system and have it built in your place. Just want the code? Roblox Studio scripts collects the main scripts from the guides, sorted by what they build, and the free tools include a game idea generator, a DevEx calculator, a Robux tax calculator, a thumbnail size checker and a Luau playground.

Using AI in Roblox Studio

What AI can and cannot do for a Roblox project today, and how to get useful Luau out of it.

GuideUse AI in Roblox StudioAssistant, the MCP server, plugin agents and chatbots, compared plainly.GuideMake a Roblox game with AITwo real runs: the prompts, what the AI built in Studio, what it missed and what you still do yourself.GuideAssistant limits and fixesThe documented limits, Agent vs Plan, own API keys, and fixes when it stops working.GuideConnect Claude or Cursor to StudioStudio MCP setup: quick connect, JSON config, the tools and working safely.GuideFree AI for Roblox StudioWhat each tool gives you free: allowances, resets, card rules and sources.GuideUse Claude Code with StudioInstall, connect, permissions, Script Sync and a CLAUDE.md for Roblox.GuideUse Cursor or VS Code with StudioScript Sync or Rojo for files, Luau tooling, and Cursor over MCP.GuideUse OpenAI Codex with StudioInstall, connect over MCP, keep approvals on, and an AGENTS.md for Roblox.GuideConnect ChatGPT to StudioThe desktop app route, what ChatGPT on the web cannot do, and approvals.GuideConnect Claude Desktop to StudioQuick connect, the config file, approvals, and why claude.ai cannot do it.GuideUse Gemini with StudioAntigravity or Gemini CLI over MCP, the config files and approvals.GuideUse GitHub Copilot with StudioCopilot in VS Code over MCP: the config file, approvals and fixes.GuideStudio MCP not working: fixesEach symptom of a broken Studio MCP connection, its cause and the fix.GuideYour own API key in AssistantAdd an Anthropic, OpenAI or Google key to Assistant: steps, effects and open questions.GuideRoblox Assistant vs ChatGPTWhat each can see and do in your place, for scripts and builds, from each product's own docs.GuideCode Assist in the Script EditorWhat it suggests, the shortcut, how to turn it off, the daily cap and the privacy notes.GuideAI mesh and 3D model generatorThe /generate_mesh command, procedural models, segmentation, the limits and the gaps.GuideTexture and Material GeneratorWhere the two tools are, Fast vs Quality, what they output, and the documented limits.

How to make each kind of game

Obby, tycoon, horror, tower defense, battlegrounds, RNG and more: what makes each genre work, the systems it needs and a build plan. All 26 in one place: Roblox game genres. Which ones creators ask an AI to build most: our 2026 build data.

HubRoblox game genresTwenty-six genres, each with its core loop, the systems it needs and a build plan.Genre guideMake an obby gameStage design, difficulty curve, checkpoints, skip stage and retention.Genre guideMake a pet gameAdopt, care, grow up and trade pets, with eggs sold inside Roblox rules.Genre guideMake a horror gamePacing, a monster that hunts by sight and sound, a flashlight and atmosphere.Genre guideMake a tower defense gamePaths, tower roles, waves, targeting, placement and summon rules.Genre guideMake a battlegrounds gameCombos, moves with cooldowns, stun, block, knockback and movesets.Genre guideMake a zombie survival gameEscalating waves, hordes, barricades, scarce ammo and co-op revives.Genre guideMake an FPS gameGun feel, maps, safe spawns, kill credit, match scoring and modes.Genre guideMake a racing gameCars that handle, laps the server counts, race flow and fair car sales.Genre guideMake an RNG gameOdds design, a server roll, luck boosts and the paid random item rules.Genre guideMake a farming gamePlots, crops that grow while you are away, selling, fishing and saving.Genre guideMake a roleplay gameJobs, wages, houses, cars and the safety work a town game needs.Genre guideMake a sports gameA soccer ball the server owns, checked kicks, goals, teams and matches.Genre guideMake an RPG gameExplore, fight, level up: zones, XP shared by damage, quests and saving.Genre guideMake an escape room gamePuzzle rooms with server-checked clues, and +1 speed keyboard escapes.Genre guideMake a killer vs survivors gameOne killer, many survivors: a fair pick, objectives, an exit and balance.Genre guideMake a Grow a Garden gameRestocking seed shop, real-time growth, mutations, selling and fair seed packs.Genre guideMake a parkour gameMovement that feels good, timed runs the server checks, and best times.Genre guideMake a story gameChapters, a narrator, group choices and endings, run by the server for the whole party.Genre guideMake a survival gameGather, craft on the server, keep fed and live through the night.Genre guideMake a natural disaster gameRounds with a random flood or meteor shower, survivors, and a map that resets.Genre guideMake a dress up gameA theme, a dressing room, a runway and a star vote the server counts fairly.Genre guideMake a hide and seek gameA fair seeker pick, a hiding phase, server-checked tags and rounds.Genre guideMake a restaurant gameCustomers order, players cook at stations and serve, and tips buy upgrades.

Scripting foundations

Where scripts run, how the client and server talk, and how to organise code so it stays readable.

TutorialStart scripting in StudioYour first Luau scripts: variables, functions, events, loops and where scripts go.ExplainerLocalScript vs Script vs ModuleScriptWhere each script type runs, and where to put it.TutorialRemoteEvents and RemoteFunctionsClient to server and back, with the checks the server needs.TutorialMake your first gameFrom a Baseplate to a published coin course, with two server scripts.GuidePublish a Roblox gamePublish from Studio, release to players, ratings, audience, fees and limits.GuideAll-ages and 250 playersWhy a game only reaches 16+, the Kids and Select requirements, and the 250 highly engaged players rule.GuideRoblox Studio modelsThe Creator Store and Toolbox: finding, inserting and checking models before they go in your game.GuideBest Studio plugins13 plugins for building, animation, UI and code, with price and Creator Store favorites.GuideGet players on RobloxHow recommendations work, the signals that matter, and how to use Roblox ads well.GuideBlender to Roblox StudioUnits, FBX vs glTF, Importer settings and the Roblox Blender plugin.GuideMake money with DevExEarned Robux, the DevEx rates, the 30,000 minimum and how to cash out.GuideFind Roblox collaboratorsWhere to find scripters, builders and artists, Team Create rules, paying fairly and avoiding scams.GuideIcons and thumbnailsSizes, upload steps, video rules and how thumbnail personalization works.GuideKeep players coming backWhat D1, D7 and D30 retention mean and what to fix for each one.GuideFix lag in your gameMeasure the problem, then fix parts, meshes, shadows, physics, scripts and NPCs.GuideLighting and atmosphereThe Lighting settings that matter, Atmosphere for fog, and post-processing effects.GuideMusic and soundsFree audio, upload rules and limits, and why audio will not play.TutorialKey presses with UserInputServiceKeybinds that ignore chat typing, held keys, mouse buttons and touch buttons.TutorialTweenService for partsSmooth movement, rotation, fading and loops, with every TweenInfo setting explained.TutorialRaycasting with workspace:RaycastCast rays, ignore your own character, see the ray, and use it for ground checks and aim.TutorialCollectionService tagsTag many parts and run them all from one script, including parts added later.TutorialAttributes: SetAttribute and GetAttributeCustom settings and state on any instance, read and watched from scripts.TutorialDebounce and cooldownsStop Touched firing ten times, add cooldowns per player and rate-limit remotes.TutorialModuleScripts and requireWrite code once and use it from every script, with settings, functions and shared data.TutorialTables and loopsArrays, dictionaries, ipairs, pairs and the loop mistakes that cause errors.

Player data and leaderboards

Stats on the player list, and saving progress so it survives the next session.

Game systems

Complete, working systems you can drop into a place and extend.

TutorialMake a shop GUIA coin shop GUI where the server checks every purchase.TutorialMake a round systemIntermission, random maps, teleports, a shared timer and Wins.TutorialNPC pathfinding and chasingFollow the nearest player, jump, repath, and stop the stutter.TutorialMake an inventory systemStacking slots, a grid UI, equippable Tools and saving.TutorialMake obby checkpointsStages in order, respawning at the last checkpoint, saving and skip stage.TutorialSell a game passCreate a pass, check who owns it, prompt the purchase and grant perks safely.TutorialMake a tycoonClaim pad, droppers, conveyor, collector, upgrade buttons and saving.TutorialMake a swordA sword Tool whose hits, damage and cooldown are decided by the server.TutorialMake a raycast gunA blaster whose shots, damage and ammo are checked by the server.TutorialShift to sprintShift to sprint on every device, then stamina, a dash and a double jump.TutorialMake a simulator gameClick for coins, upgrades and rebirths, decided and saved by the server.TutorialMake a main menuA title screen with a Play button, a menu camera and a clean spawn.TutorialMake a cutsceneCamera shots from parts, captions, a Skip button and a server that decides when it plays.TutorialMake a talking NPCPress E to talk, branching choices, and rewards the server checks.TutorialMake a door that opensPress E to open: swinging or sliding doors, auto close and key locks.TutorialMake a teleporterTeleport pads, a teleport menu and portals to other places, all decided by the server.TutorialPlay an animationOn a key press, as a looping toggle, on an NPC, and timed to an animation event.TutorialMake a loading screenReplace Roblox's default screen, show a progress bar, offer Skip and fade out.TutorialMake a Steal a Brainrot gameConveyor, bases, buying, stealing, base locks and saving.TutorialAdmin panelRanks, kick and bans that work across every server.TutorialChat commandsSlash commands with TextChatService, with admin-only ones the server checks.TutorialQuest systemCollect and defeat quests, tracked and saved by the server, with a quest GUI.TutorialSpectate systemA spectate button with next and previous that follows other players' cameras.TutorialAFK detection and kickMark idle players AFK, move them to an AFK zone, and kick them after a while.TutorialAnti-exploit server checksValidate remotes, rate limit them, check speed and teleports, and know the limits.TutorialRound countdown timerA timer every player sees in sync, set once by the server and counted down on screen.

Gameplay mechanics

Kill bricks, pads, platforms, pets, teams, combat and the day and night cycle: the pieces players touch every minute.

TutorialKill brick and lavaA part that kills on touch, damage bricks and lava that rises over time.TutorialPet that follows youA floating pet that trails its owner smoothly, using physics constraints.TutorialDay and night cycleTurn the clock with Lighting.ClockTime and switch lamps on at dusk.TutorialAdmin commandsChat commands like /kick and /tp that only your admins can use.TutorialTeam systemTeams with their own spawns, a balanced team picker and team-only doors.TutorialSpeed and jump padsPads that boost speed for a few seconds or launch players upward.TutorialCombat and hitboxesA punch combo with a server hitbox, cooldowns, no friendly fire and KOs.TutorialCharacter customizationSkin colour, height and clothing picked in a menu, applied on the server.TutorialMoving platformA platform players can ride, moved by physics instead of teleporting.TutorialCar scriptA car you can drive, built from constraints, plus a spawner.TutorialTerrain generatorIslands, hills, beaches and a lake, made of real Terrain.TutorialPress E to interact promptsProximityPrompts that work on every device, checked on the server.TutorialCamera shake on explosions and hitsA smooth shake that fades out, started by the server, with an off switch.TutorialMake a tool players can holdA Handle, a click action, a healing potion, a flashlight and giving tools from the server.TutorialClickable parts with ClickDetectorClick a part to run code, know who clicked, add hover effects and cooldowns.TutorialDouble jumpJump again in the air, refill on landing, and triple jumps set by the server.TutorialDash on QPress Q to dash, a cooldown, a phone button and a trail other players see.TutorialCrouch on CHold C to crouch, walk slower, fit under gaps and stay down under low ceilings.TutorialStamina barSprint drains a bar that refills after a rest and turns red when you run low.TutorialFall damagePlayers lose health after long falls, on the server, with water landings safe.TutorialRagdoll on deathCharacters fall limp with bending joints instead of breaking into pieces.TutorialFirst person lockLock the camera in first person, toggle it, or lock it only in certain rooms.TutorialMorph into a modelTouch a pad or click a button to become another character, seen by everyone.TutorialLow gravity zonePlayers float, jump higher and fall slower inside one area of the map.TutorialRising lava roundsRounds where lava climbs the map, kills on contact and survivors win.TutorialMelee hitboxesA server-side box in front of the attacker that hits each enemy once per swing.TutorialFireball projectileThrow a fireball where you aim: the server moves it, finds the hit and deals blast damage.TutorialRain and weatherClear, rain and storm chosen by the server, with rain that stops under roofs and thunder.TutorialElevator with floor buttonsA lift that carries players between floors, called from buttons inside and outside.

Rewards, pets and trading

Coins, eggs, codes, daily rewards, fishing and trades, with the server deciding every number.

Menus, HUD and sound

Health bars, minimaps, settings, music and menu animations, built in code you can restyle.

Debugging

Reading the Output window, understanding error messages and fixing them for good. Looking up one message? See Roblox Studio error messages.

Questions

Where should I start if I have never scripted in Roblox?

With how to script in Roblox Studio: where scripts go, your first script, events and reading the Output window. Then make your first game, and learn how the two sides of a game talk in client and server scripts and RemoteEvents.

What language are Roblox scripts written in?

Luau, the language Roblox made from Lua 5.1. It adds optional types and a few extras, so most Lua 5.1 code still runs. Every guide here is in Luau, and you can try short snippets in the Luau playground without opening Studio.

Can I use the code from these guides in my game?

Yes. Copy any script without an account and change it to fit your game. The main script from most guides is also on Roblox Studio scripts, sorted by what it builds.

Is the code tested?

Every Luau block in these guides passes Luau's strict type checker, luau-lsp, against Roblox's API definitions. A type check catches misspelt APIs and wrong types, not game logic, so press Play and watch the Output window before you publish. Scripts that were also run in Studio say so, with the date.

My script shows an error. Where do I look it up?

Copy the red line from Output and find it in Roblox Studio error messages: each page gives the causes, the code that triggers each and the fix. For a routine that works on any error, read how to fix Roblox script errors.

RoCode in other languages. In Spanish: IA para Roblox Studio, Crear juegos de Roblox con IA. In Portuguese: IA para Roblox Studio, Criar jogos no Roblox com IA. In French: IA pour Roblox Studio, Créer un jeu Roblox avec l'IA. In German: KI für Roblox Studio, Roblox Spiel erstellen. In Indonesian: AI untuk Roblox Studio, Cara membuat game di Roblox. In Russian: ИИ для Roblox Studio, Как сделать игру в Roblox. In Turkish: Roblox Studio için yapay zeka, Roblox oyun yapma. In Italian: IA per Roblox Studio, Come fare un gioco su Roblox. In Polish: AI do Roblox Studio, Jak zrobić grę w Roblox. Every page in each language links the others from its footer.

Or let RoCode write it in your place.

Every guide here works by hand. RoCode is the shortcut: describe the system, and it writes the Luau and builds it in the place you have open.