Values dividing and changing for no reason whatsoever

I’m making a spinning system and handle all of the information in my server script. When I remove a spin from the player values it divides and changes from what I originally wrote. Any help?

Also I’m not getting any errors in the output, and I am positive no other parts of the script is interfering with the values.

I think you should use the += operator instead of = to change the gems because the new gem value should be equal to oldGems + randomAmount. Therefore the following should do:

bits.Parent.Gem.Value += WeightedRandom() 
--which is equal to:
bits.Parent.Gem.Value = bits.Parent.Gem.Value + WeightedRandom() 
1 Like

Hi
That’s not what I am trying to achieve. The problem right now is the fact that the spinner is just taking random amounts of spins from what the player originally has
https://gyazo.com/5a8609ee0e8d4ddf2f64939aea79c92e

In the video you can see that the first time I spin, it takes away 2, but the next time it takes only one. I don’t know why it’s doing it and I’m not sure how to fix it.

Check if the remote is firing more than once. If yes, then it may be a bug with your local script(I assume the second time it also fires twice but due to the spins.Value > 0 check the second time has no effect).

You are right. I added a print in the local script and it looks like that’s the problem. How would I go about fixing this though? I’m not sure whats wrong with the local script. Would a debounce work?