Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do I decrease the leaderstats value with a click detector?

I tried to make it whenever the player clicks the part, their money goes down by 10, it does not go down, what do I do

Script:

local click = script.Parent

click.MouseClick:Connect(function(player)
	local leader = player:WaitForChild("leaderstats")
	local cash = leader:WaitForChild("Cash")
	local money = cash.Value
	
	money = money - 10
end)

1 comment

0

Get rid of line 6, then change line 8 to "cash.Value = cash.Value - 10"

1 answer

✓ Accepted answer
click.MouseClick:Connect(function()

player.leaderstats.Cash.Value = player.leaderstats.Cash.Value -10 --How ever much you want to subtract

This discussion is preserved as it was. New answers, comments, and votes are closed.