Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I short respawn time?

Asked by 8 years ago

So what I am trying to do here is shorten the time between death and respawn. Like, usually when you die it takes 5 seconds to get back up, but how can I shorten that? Once I tried this script in a backpack:

local player = script.Parent.Parent
local char = player.Character
local h = char.Humanoid
h.Died:connect(function()
    wait(0.5)
    player:LoadCharacter()
end)

The problem with that is that they respawn 2 times, one in 0.5 seconds, and one in 5 seconds.

Can someone help?

2 answers

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

Turn off CharacterAutoLoads

Ad
Log in to vote
0
Answered by 8 years ago

1. While in Studio, set Players' ``CharacterAutoLoads property to false. 2. Then, change the script to this:

game.Players.PlayerAdded:connect(function(p)
    p:LoadCharacter()
    local char = p.Character
    repeat wait() until char
    local human = char:WaitForChild("Humanoid")
    human.Died:connect(function()
        wait(0.5)
        p:LoadCharacter()
    end
end)
0
Character is not a child of Player. 1waffle1 2908 — 8y

Answer this question