✓ Accepted answer
Hello.
It's simple. Define a boolean value. At the beginning of the script check the boolean value. If it is true, then return nothing and stop the script, else, continue running the script.
After you set the humanoid speed to 0, set the boolean value to true, so the code won't run until the boolean value it's false. Wait AMOUNT OF TIME then set the boolean to false.
If I was you, I'd wait 1 or 2 more seconds before setting the boolean to false, after you set humanoid's speed back to normal, to give the character time to get away from the part. Here's an example:
local Frozen = false
function Slowdown(hit)
if Frozen then return end
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.WalkSpeed = 0
Frozen = true
wait(5)
hit.Parent.Humanoid.WalkSpeed = 16
wait(2)
Frozen = false
end
end
script.Parent.Touched:Connect(Slowdown)
1 comment
dude try google first, and this is like the fourth time u have asked a question like this.