Var += 1 not work correctly when Var changed before 1 was added to value

What I mean by the title is that Var += 1 uses old value before adding one

Here’s my code:

	local count = 1
	repeat
		task.wait(1)
		Time.Value -= 1
		count += 1
	until Time.Value <= 0

Video:

1 Like

It looks like the issue is that you don’t end the loop when you run the command.

Yeah, but why doesn’t it use the new value before incrementing it? Is this a bug?

It should work, check where you placed the variable count in the script, is it in a loop? is it in a function?

1 Like

Found bug: It’s just that I was not setting the GUI correctly and that it desyncs with the client.

I didn’t use the variable so I deleted it.
I think it was a leftover when I switched from while to repeat.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.