Variables are like small boxes where you can store information, such as numbers or text. They help you keep your code organized and reuse values multiple times.
Here's how:
With variables, you can make your Luau code much more flexible and easier to understand – just give it a try!
-- Dieses Script kommt z.B. in ServerScriptService
local score = 0 -- Punkte speichern
local playerName = "Spieler123" -- Name speichern
-- Funktion, um Punkte zu erhöhen
local function addPoints(points)
score = score + points -- Punkte addieren
print(playerName .. " hat jetzt " .. score .. " Punkte.")
end
-- Beispiel-Aufruf der Funktion
addPoints(10)