RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"give the player 5 coins when they advance a stage"
-- server script local Players = game:GetService("Players") local function onPlayerAdded(player) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Coins = Instance.new("IntValue") Coins.Name = "Coins" Coins.Value = 0 Coins.Parent = leaderstats local Stage = Instance.new("IntValue") Stage.Name = "Stage" Stage.Value = 1 Stage.Parent = leaderstats Stage.Changed:Connect(function(newValue) if newValue > Stage.Value then Coins.Value = Coins.Value + 5 end end) end Players.PlayerAdded:Connect(onPlayerAdded)