Refresh variables, functions, conditionals, loops, tables, and events — the parts of the language you'll use all course long.
You've now got the whole Luau toolbox: variables that remember, functions that repeat jobs, conditionals that decide, loops that repeat, tables that hold many things, timing, and events that answer the world. This lesson packs it all into one quick lap — because the next section, player data, leans on every single piece.
A variable is a named box. Declare it with local, read it, and change it — coins = coins + 1 reads the box, adds one, and stores the result back.
What is wrong with this line: if coins = 5 then
A function wraps a job: function addCoins(amount) ... end, then you call it with addCoins(5). Defining does nothing until you call. A conditional makes a choice — Luau checks the if, then each elseif, and only if none matched does else run.
What does defining a function do by itself?
while true do ... task.wait(1) end repeats forever with a beat. A for loop counts for a known number of times. Tables are boxes that hold many values, and you pull them out by position. task.wait pauses; task.delay schedules and moves on.
You don't watch for things; you listen. part.Touched:Connect(function(hit) ... end) signs up a callback that the engine runs whenever the event fires. :Connect runs nothing now — it registers the function for later.
What does :Connect do?
Variables, functions, conditionals, loops, tables, timing, events — that's the whole language core. The next section plugs it into the real world: the player, their data, and the trust rules around it.