Normally RespawnTime would get interrupted and not go on if the player dies and respawns manually but in the case where CharacterAutoLoad is enabled, it doesn’t get interrupted and still goes on, respawning the player immediately if they die again.
Reproduction Steps:
- Make a place with CharacterAutoLoad enabled and
RespawnTimeset to >20 respawn time. - Die and wait either 10 to 15 seconds to respawn manually through
LoadCharacter. - Die again and notice how the player instantly respawns again upon dying. (Before 20 seconds have reached)
Scripts:
Client:
game:GetService("ContextActionService"):BindAction("RespawnRequest", function(_, state: Enum.UserInputState)
if state ~= Enum.UserInputState.Begin then
return
end
game:GetService("ContextActionService"):UnbindAction("RespawnRequest")
game:GetService("ReplicatedStorage").Respawn:FireServer()
end, false, Enum.KeyCode.R)
Server:
game:GetService("ReplicatedStorage").Respawn.OnServerEvent:Connect(function(Player:Player)
if not Player.Character then
return
end
if Player.Character:GetAttribute("Respawing") then
return
end
if Player.Character:FindFirstChildOfClass("Humanoid"):GetState() ~= Enum.HumanoidStateType.Dead then
return
end
Player.Character:SetAttribute("Respawing", true)
Player.Character:Destroy()
Player.Character = nil
Player:LoadCharacter()
end)
Expected behavior
For RespawnTime to be interrupted and not go on if the player respawns manually through LoadCharacter