TutorialsMay 21, 202610 min read

How to Make a Roblox Script: Complete Beginner's Tutorial (2026)

Learn how to make a Roblox script from scratch. Step-by-step Luau tutorial covering Script vs. LocalScript, ServerScriptService, your first working script, and how to use AI to skip the hard parts.

What Is a Roblox Script?

A Roblox script is a small program written in Luau (Roblox's flavor of Lua) that tells your game what to do. Scripts handle everything dynamic: when a player joins, what happens when they touch a part, how damage works, what the shop UI displays, when DataStore saves progress.

Roblox Studio script editor with Luau code being written

If you can build a 3D world in Roblox Studio, you can build a beautiful diorama — but it won't be a game until you add scripts. This tutorial covers how to make a Roblox script from absolute zero, with three working examples and the shortcuts experienced developers use to skip the tedious parts.

The Three Types of Roblox Scripts

Before you write anything, you need to know which type of script to use. There are three:

  • Script (server): Runs on Roblox's servers. Use for anything that affects all players or needs to be secure — DataStore, damage, game pass checks, round logic.
  • LocalScript (client): Runs on the individual player's device. Use for UI, camera control, input handling, and client-side visual effects.
  • ModuleScript: A reusable library. It doesn't run on its own — other scripts require() it to use shared functions or data.

Rule of thumb: if a malicious player could exploit it (giving themselves coins, skipping pay walls, doing fake damage), put it in a server Script. Never trust the client.

Step 1: Open Roblox Studio and Create a New Place

  1. Download Roblox Studio from create.roblox.com if you haven't already (it's free)
  2. Click New > Baseplate to create an empty world
  3. You'll see a flat gray platform — your blank canvas

Step 2: Find the Explorer and ServerScriptService

The Explorer panel (right side of Studio — open from the View tab if hidden) shows everything in your game as a tree. The folder you'll use most for server scripts is called ServerScriptService.

To add a new script:

  1. Right-click ServerScriptService in the Explorer
  2. Click Insert Object > Script
  3. Double-click the new Script to open the code editor

This is the basic answer to "how to put scripts in Roblox" — you parent them to the right service depending on whether they should run on the server or client.

Step 3: Write Your First Roblox Script

Delete whatever default text is in the editor and paste this:

print("Hello, Roblox!")

Now hit the Play button at the top of Studio. Look at the Output panel (View tab > Output). You should see:

Hello, Roblox!

Congratulations — you just made and ran your first Roblox script.

Step 4: A Useful First Script — Welcome Players by Name

"Hello, Roblox!" isn't very exciting. Let's make a script that does something real. Replace your code with this:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
  print(player.Name .. " just joined the game!")
end)

Hit Play. As your test character spawns, the Output window prints YourName just joined the game!

What's happening here:

  • game:GetService("Players") grabs the Players service, which tracks everyone in the game
  • Players.PlayerAdded is a signal that fires whenever a new player joins
  • :Connect(function(player) ... end) attaches a function that runs when the signal fires, with the new player passed in

Step 5: A Working Kill Brick — Roblox's "Hello World" of Game Scripting

Almost every Roblox tutorial includes a kill brick because it teaches the most useful pattern in Roblox scripting: reacting when a part is touched.

  1. In the Explorer, click Workspace
  2. Add a Part to the world (Home tab > Part > Block) — place it in the air a bit so players will run into it
  3. Color it red (Properties > BrickColor > Really red) so it looks dangerous
  4. Right-click the part > Insert Object > Script
  5. Paste this into the script:
local part = script.Parent

part.Touched:Connect(function(hit)
  local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
  if humanoid then
    humanoid.Health = 0
  end
end)

Hit Play, walk your character into the red brick, and watch it die. You just built a working kill brick from scratch. This is the most reused pattern in Roblox — touched detection, humanoid lookup, applying an effect.

Step-by-step Roblox script creation process visualized

Step 6: A LocalScript Example — Press F to Open a Menu

For UI and input, you write a LocalScript instead. Right-click StarterPlayer > StarterPlayerScripts in the Explorer, Insert Object > LocalScript, and paste:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
  if gameProcessed then return end
  if input.KeyCode == Enum.KeyCode.F then
    print("Player pressed F!")
  end
end)

Run the game and press F. The Output prints "Player pressed F!" each time. Replace the print with code that opens a UI panel and you have a working menu hotkey.

Common Beginner Mistakes (and How to Fix Them)

  • Putting server logic in a LocalScript. Players can edit local scripts. Anything affecting other players or game state belongs in a server Script.
  • Forgetting to anchor parts. A part that should sit still falls into the void if it isn't anchored. Check Properties > Anchored.
  • Using wait(). The old wait() function is deprecated. Use task.wait() instead.
  • No pcall around DataStore. DataStore calls can fail. Always wrap them: local ok, err = pcall(function() ... end).
  • Looking for nil children. Use :FindFirstChild("Name") instead of .Name when the child might not exist.

Where to Get Roblox Scripts If You Don't Want to Write Them

If you'd rather not learn Luau from scratch, you have three options:

  1. Use an AI Roblox script generator. Tools like Obby let you describe what you want in plain English and produce working Luau. This is by far the fastest path in 2026.
  2. Copy from the Creator Hub. create.roblox.com/docs has hundreds of working code samples with explanations.
  3. Use the Roblox Studio Assistant. Built into Studio, free, generates Luau from prompts.

One important note: there are sites that distribute "free Roblox scripts" labeled as exploits or cheats. Don't use them. They violate Roblox's terms of service and almost always contain malicious code that compromises your account.

From Scripts to a Full Game

Knowing how to make Roblox scripts is essential, but stringing together dozens of scripts to make a complete game is where most projects stall. Obby generates entire game systems — combat, DataStore, GUIs, game passes — wired together correctly from one prompt. Start there to skip the scaffolding and focus on what makes your game unique.

Start building your Roblox game with AI →

Frequently Asked Questions

How do I make a script in Roblox Studio?

Open Roblox Studio, right-click ServerScriptService in the Explorer, choose Insert Object > Script, double-click the new script, and write Luau code in the editor that opens. Hit Play to run it.

What language do Roblox scripts use?

Roblox scripts are written in Luau, a typed variant of Lua optimized for Roblox. It's beginner-friendly and well-documented at create.roblox.com/docs.

Where do I put scripts in Roblox?

Server-side game logic goes in ServerScriptService. Client-side scripts go in StarterPlayer > StarterPlayerScripts. Scripts attached to a specific part (like a kill brick) are parented to that part.

What is the difference between Script and LocalScript in Roblox?

Script runs on the Roblox server and affects everyone — use for secure logic. LocalScript runs on a single player's device — use for UI, input, and camera.

Can I make a Roblox script without learning Luau?

Yes. Roblox's Studio Assistant and AI tools like Obby generate complete Luau scripts from plain-English descriptions. You can build entire games without writing scripts by hand.

Ready to build your Roblox game?

Obby lets you build Roblox games with AI — describe your game and we build it. No coding required.

Try Obby Free →