Everytime I click a button, the countdown is spammed with more countdowns

  1. Basically, all I’m having trouble with is figuring out how to fix my clock, right now it’s doing this:

  2. Every time I multiple buttons it starts doing this and I’m wondering how do I go about fixing it? I was considering doing tick() or adding if statements, but I don’t know much about tick() statements for me to actually put it inside of the script.

If you could please explain what I can do, it will be really helpful.



The problem is that you are starting a new for loop everytime somebody clicks a button and fires the vote event to the server. This causes multiple for loops to run at once.

1 Like

It seems to me that this part may be the issue(see screenshot)
Why do you have that inside the Vote.OnServerEvent function?
Shouldn’t that be in a separate place since every time someone new votes and they don’t have a previous vote, that for loop seems to be executed after 5 seconds.
A side note, could you use code blocks instead of screenshots next time, so it’s easier to look through the code you’re showing?

1 Like

I can, also when making this code, I did this:

I’m not the best at scripting, all I did for this code was debug some errors I had with it earlier, I just got confused on what to do about the clock. Also if I did move that line of code you circle out of the OnServerEvent function, will anything impact the script or will it run perfectly fine?

Yeah, I just realized that. But I’m still confused on how do I make it where the clock doesn’t get impacted once it starts up, for example once the server is fired, the clock still runs fine without it doing that. I was thinking about watching more tutorials about tick(), but I wanted to get other’s opinions on devforums first on what I could possibly do.

Nevermind, it worked, thank you.