πŸš€ Roblox Studio Scripting Tutorial (Part 2)

6. ✍️ Variables

Store values like numbers, names, objects:

local health = 100
local playerName = "Mahryx"
print(playerName .. "'s health is " .. health)

7. βš™οΈ Functions

local function greet()
  print("Welcome!")
end

greet()

8. 🚨 Events

Detect when something happens:

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

9. πŸ› οΈ Tool Activation

Detect when a tool is used:

local tool = script.Parent
tool.Activated:Connect(function()
  print("Tool used!")
end)

10. πŸ† Leaderstats

Track stats like coins, kills, etc.:

game.Players.PlayerAdded:Connect(function(player)
  local stats = Instance.new("Folder")
  stats.Name = "leaderstats"
  stats.Parent = player

  local coins = Instance.new("IntValue")
  coins.Name = "Coins"
  coins.Value = 100
  coins.Parent = stats
end)

🧠 Final Quiz: Roblox Studio Code Mastery