So, I inserted this code (code will be pasted at the bottom) into a local script and placed that script in StarterPlayerScripts. I have no idea why it isn't working. This code is supposed to reset your cash to 0 if you have 100 or more.
local cash = script.Parent.Parent.leaderstats.Cash.Value
local limit = 100 -- Change this to whatever you want the max value to be.
cash.Changed:connect(function(Value)
print'cash'
if cash >= limit then -- If the cash if equal to or greater than 5, then set it to 0.
cash = 0
end
end)

2 comments
Is there a certain place I should put this script or can I just place it in ServerScriptService?
Just make sure it's in a LocalScript.