script.Parent.Touched:connect(function(Part) if Part:FindFirstChild("Cash") then Part.Cash.Value = Part.Cash.Value * 2 end end) -- When the game lags the parts are worth millions each due to debounce
Is there a way i can avoid this problem, when i test play i get millions/billions and it's game breaking. I want it so that every single part gets upgraded 2x max and can't be upgraded above 2x (just 2x the part's value). -- Btw this is a upgrader.
To fix this you would need to add a debounce. I'm not sure what you mean by blaming the issue on a debounce as your code doesn't seem to have one.
Edit: regarding your comment, I'm still not sure what you're trying to do but you could keep a list of parts that had touched the part, and if a part hadn't touched it before then the effect could be done.