I have a script that kicks people when they die, but I want the kick to be delayed a second or two, I don't want it to be immediate since I have a death GUI I want them to see before they go. Any ideas? Thank you in advance, I'm very new to scripting.
✓ ANSWER ACCEPTED
Looking to make a kick on death with a delay?
2 answers
✓ Accepted answer
Answers by greatneil80 and Nowaha are what you are looking for. Use delay after died function, here is how it should look like: (Normal script inside ServerScriptService)
local Delay = 2
local Reason = ""
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").Died:Connect(function()
wait(Delay)
Player:Kick(Reason)
end)
end)
end)
1 comment
0
Ah, thank you! Everyone here is so helpful :D
To make a delay anywhere in your code, you can use the wait() function.
wait(2), in example, will wait for 2 seconds before it continues with the code below it.
-- Code before waiting
wait(2)
-- After 2 seconds, everything below here will happen.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
wait(2)