You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Basically, in my fighting game there’s stuns, and they work like this: every player hasIsStunned
BoolValue inside their character and it stuns them and dosen’t let them do anything. In the script where i create hitboxes, i haveStun
(bool) andStunDuration
, and if the stun is true it sets theirIsStunned
To true, but the problem is when the duration runs out it immediatly sets theirIsStunned
To false, but i need it so if another stun had been activated on the player, it renews their timer. -
What is the issue? Include screenshots / videos if possible!
What is happening right now is that if you apply the stun 1 time it works fine, but if i apply stun while the player is stunned, when his previous stun runs out it sets itIsStunned
To false and dosen’t wait until the second is stun is also finished. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have checked a lot of things online and on the forum and can’t find a solution that will work for me.
Heres the part, how would i go about making it that it renews the timer if another stun has been added? (btw sorry if this post is bad, first time posting)
if Stun == true then
local StunTimeLeft = StunDuration
local EnemyCharacter = Humanoid.Parent
local StunBool = EnemyCharacter:WaitForChild("IsStunned")
StunBool.Value = true
if StunDuration then
task.delay(StunDuration, function()
StunBool.Value = false
end)
else
task.delay(2, function()
if StunBool.Value == true then
return
end
StunBool.Value = false
end)
end
end