I don’t mind if you are marked as solution, but just so you know, I actually already identified the problem in my first post, which is explaining how the reason that the OP’s script did not work was due to not updating the “dif” variable when the coin value is set to 0:
You basically restated the same problem in your first post:
And in addition, you recommended the OP to use wait() instead of using events. The problem with wait() in this scenario is that:
If wait() is running smoothly, you’re running the code at a rate of about 10 times a second
wait() could be laggy and wait up to seconds
The code wouldn’t immediately run after the coin value changes
There’s a reason why events exist and please use them if applicable, which in this case it is. I recommend you look at this post: Avoiding wait() and why. Finally, sorry if this offends the OP, but it appears as if the OP is only seeking for spoon-fed code instead of trying to solve the problem themselves.
For the wait(), I recommend using it as events are unreliable. Sometimes the client doesn’t receive it because of internet instability and therefore the client would not be able to update it.
You COULD use RunService.RenderStepped:Wait() or task.wait(), both of which are more efficient than wait(). Also, you could always just handle the event on the server and fire a remote event.
If the client has internet instability, I don’t think we can do anything about it.