Stunlock/Best way to extend a value

I’ve been trying to figure out how to create a extendable countdown for stunlock.
For example, you could hit a player, they’d get stunned for a certain amount of time, but if you hit them before that time runs out, it restarts it. So you could achieve combos, of some sort.

Here’s the code I’m using to achieve this. It’s in ServerScriptService. There are two variables. Stunned and StunTime. Stunned is a BoolValue within the player that is if the player is stunned. StunTime is a NumberValue that shows how long it is. Pretty self-explanatory.

Function

Although, with my timer script, I’ve run into some weird results with printing. I use the stunlock on the player for big moves, like this swing. But I mostly want it for PvP battle stunning!

Uhh… also… the character isn’t naked… it just… has no clothes at the moment… the game is gonna have clothes, trust me.
For the most part, I thinkkkkk the stunning works okay, other than the behind the scenes weird printing.

What I’m wondering is:
-Why is it throwing out an extremely large number
-Why does it print out that the player got unstunned like… 5 times.
And
-Is there a better way to do this? Extending a countdown? Stunlock? Are Instance values not the way to go?

Any help would be great considering I’ve tried a few different ways to do this. Some not working at all.
And also, have asked this before on the forums, but to no avail.

Try using tick() instead of wait:

Sorry that I don’t understand.
Could you explain in what way?

I know that Tick() can get the time between one point and another.
But how does that work with the stunvalue possibly being changed?