Help With A Script

Seems theres an issue. The “script.Parent.CandyLeft.Value” is an int value, but after 0, it keeps going. Can I get help?

Code:

if script.Parent.CandyLeft.Value >= 0 then
		script.Parent.CandyLeft.Value = script.Parent.CandyLeft.Value -1
		pickCandy()
	end

Try this:

if script.Parent.CandyLeft.Value > 0 then
		script.Parent.CandyLeft.Value-=1
		pickCandy()
	end

It would let you take one more if there’s 0 candy left because you used >= 0 when you should do > 0

if script.Parent.CandyLeft.Value > 0 then
	script.Parent.CandyLeft.Value = script.Parent.CandyLeft.Value - 1
	pickCandy()
end

And as @Demon edited, you should use -= to not repeat the code

if script.Parent.CandyLeft.Value > 0 then
	script.Parent.CandyLeft.Value -= 1
	pickCandy()
end