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

How and Why wouldn't my Forever Death work?

Asked by
woodengop 1134 Moderation Voter
9 years ago

I was testing on my script, I did use the Diedevent. Here is the Code I used:

local hum=game.Players.LocalPlayer.Character.Humanoid
hum.Died:connect(function()
    hum.Parent:Destroy()
end)

The character does destroy, However, The Character Does load after 5 seconds.

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

This is because the Died event activates the LoadCharacter method of the player. So the easiest way to simulate a 'permadeath' would be setting the CharacterAutoLoads Property of the player to false when they die.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        plr.CharacterAutoLoads = false
        local hum = char:WaitForChild('Humanoid')
        local connect
        connect = hum.Died:connect(function()
            plr.Character:Destroy()
            connect:disconnect()
        end)
    end)
end)
0
first, there shouldn't be an Value at the end. second, the CharacterAutoLoads should be outside the function. woodengop 1134 — 9y
Ad

Answer this question