What a script actually is, the difference between Scripts and LocalScripts, and how instructions run top to bottom.
In the last lesson you made a script print a message. That script was a tiny list of instructions that Roblox read once, from top to bottom, when the game started. That's all a script is.
This lesson is about where scripts live and which one runs where — because Roblox is not one computer running your game. It's two.
When someone plays your game, there are actually two copies of the game running:
That's why there are two kinds of scripts:
| Script type | Runs on | Used for |
|---|---|---|
| Script | The server | Game rules, money, things every player must agree on |
| LocalScript | One player's computer | The player's own screen, controls, and feel |
A LocalScript runs on…
Scripts execute top to bottom, one line at a time. This script:
local part = workspace.Baseplate
print("Found the baseplate")
part.Anchored = false
means: grab the baseplate, tell me when you've done it, then let it fall. Order matters — if you wrote part.Anchored = false before defining part, the script would error, because it doesn't know what part is yet.
You already know the Output window from the last lesson. print is how you watch your script work line by line. Use it freely — real developers leave print statements in code all the time while they're building.
Look at this line:
local part = workspace.Baseplate
workspace means the Workspace folder (remember: the game world)..Baseplate means "the object inside it named Baseplate".So this line reads: "get the object named Baseplate, which lives in Workspace, and call it part."
There's another way to find things that matters a lot: a script can look at its own place in the world.
local parent = script.Parent
script is a script's name for itself, and script.Parent is whatever folder or object that script is sitting inside. Developers use this constantly — the script moves with its parent and always finds what it's attached to.
A Script named 'CoinScript' sits inside a part named 'Coin'. What does script.Parent give you? local parent = script.
A Script in ServerScriptService runs when the game starts. A LocalScript in StarterPlayer > StarterPlayerScripts runs for each player.
For the rest of this section, put everything in ServerScriptService unless a lesson says otherwise — it keeps server code and client code separate, and you'll build from there.
You want a line that grabs the script's own parent so the script can find whatever it's attached to. Write the assignment using script.
-- find your own parent
PlayerAdded event later.workspace.Baseplat errors. The Output tells you exactly which line — believe it.Next up: making scripts remember things with variables.