How do I make the coin counter reset after death?

Help

So I already have a script that makes the leaderboard and the textlabel on ur screen count the coins in startedGUI and i want it to reset the starterGUI coins status to 0 after humanoid dies

thats the script btw

-- Inside StarterGui > ScreenGui > LocalScript (name it 'CounterUI')

local player = game.Players.LocalPlayer

local gui = script.Parent

local counterLabel = gui.CounterLabel -- Make sure this matches your TextLabel name

-- Function to update the label

local function updateCounter(newScore)

counterLabel.Text = "Coins: " .. newScore

end

-- Connect to leaderstats value change

player.leaderstats.Coins.Changed:Connect(updateCounter)

-- Initial update when player joins

updateCounter(player.leaderstats.Coins.Value)

Posted Jan 11, 2026, 8:08 PM UTC

22
Loading comments…