I want to make it so if the player dies the 10 second wait stops. But I have no idea how to stop the wait, would it even be possible?
Hi there,
It most definitely is possible, with a little more clarification: are you trying to cancel the wait() and continue with the code below, or are you looking to stop it and the lines underneath altogether?
I’m trying to completely stop the code, the issue is when the player dies can collide is set to true until the countdown ends, i’m trying to completely end it
While making use of the task library, you can use task.delay()
to wrap the CanCollide logic, and when the player dies, you can call task.cancel()
to stop it completely.
Ex:
local ourThread : thread
local function MakeSafeZonesNoCollided()
-- your code
end
ourThread = task.delay(10, MakeSafeZonesNoCollided)
-- the line below should call if the player dies
task.cancel(ourThread)
ourThread = nil
Couldnt you just use a repeat loop to cycle through it and use player.Humanoid.Died to stop it?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.