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

[SOLVED] How do you clone a dead character?

Asked by
MrHerkes 166
7 years ago
Edited 7 years ago

This is what i'm supposed to do: After you spawn, your body parts are still there.

game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        local h = character:FindFirstChild("Humanoid")
        if h then
            h.Died:connect(function()
                wait(5)
                local clone = h.Parent:Clone()
                clone.Parent = game.Workspace
                player:LoadCharacter()
            end)
        end
    end)
    player:LoadCharacter()
end)

However, I get this error: ServerScriptService.Script:10: attempt to index local 'clone' (a nil value) ...and then it won't clone and spawn me back in. Am I doing something wrong here?

0
Put the wait after the Clone() line, else the character could already be gone. RubenKan 3615 — 7y
0
@RubenKan It still doesn't work. MrHerkes 166 — 7y
3
You will not be able to clone the player as h.Parent is not Archivable ie the the players model. Set this to true before cloning the model. http://wiki.roblox.com/index.php?title=API:Class/Instance/Archivable  User#5423 17 — 7y
0
Thank you for the helpful info! Anyways, you should post your answer down below, so both of us can get reputation! MrHerkes 166 — 7y

1 answer

Log in to vote
0
Answered by
MrHerkes 166
7 years ago

Answer is in original post comments.

Ad

Answer this question