Need help with a datastore money/time script

I didn’t have enough space to explain what the problem I have is inside the title, but I’ll explain it right now. My current script (shown below) puts back the datastore value (money) every second if I try to subtract it. For example, if I wanted to subtract 100 money from 705, the money would initially get subtracted to 605 but the loop causes the money to go to 706, 1 above the original 705. This obviously is happening because of the interval and the script not being able to process the old amount fast enough, so I need an alternative way to add one money per second, but not affect other increases or decreases in money.
Script:

		while true do
			wait(1)
			money.Value = money.Value + 1

I think it is because you are trying to subtract the money value from the client rather than the server not because of the loop

when testing in studio, use this button to switch between server & client
image

3 Likes

Yeah, that’s it. It’s actually because I used a localscript for the subtraction. I’m gonna use a remote event and server script instead.

1 Like

localscript == from the client