function checkforzero() if Fish.Value == 0 then return nil end end script.Parent.MouseButton1Click:connect(checkforzero)
Hello, thank you for reading. I was wondering, how do I set a IntValue so that it has a limit. Let's say I want the limit to be 0. How would I script it so that if 0 was the limit, it would not go down to -1 or anything lower. Thank you for reading.
Check if it goes below then re assign it to 0
Fish.Changed:connect(function() if Fish.Value < 1 then Fish.Value = 0 end end)
Or alternatively, when editing the value, check if the result will cause it to go below 0
takeaway = 50 if not Fish.Value - takeaway < 0 then Fish.Value = Fish.Value - takeaway end
Or use both in collaboration.