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

How to make a player's leaderstats not go below zero?

How can I make a player's in-game points not drop below zero?

1 answer

✓ Accepted answer

well first set points and check to see if it doesn't go below zero like so

In a script not localscript


function CheckPoints(Points)
	if Points.Value < 0 then
	Points.Value = 0
	end
end)

game.Players.PlayerAdded:connect(function(Player) --anonymous function
	local ls = Instance.new("Configuration", Player)
	ls.Name = "leaderstats"
	local Points = Instance.new("IntValue", ls) -- classname, parent
	Points.Name = "Points"
	Points.Changed:connect(function() CheckPoints(Points) end)
end)

1 comment

0

Thanks!

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