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

Loading the players 'Customized Character' after they die??

Asked by 4 years ago
Edited 4 years ago

So I made a LocalScript in StarterCharacterScripts and its supposed to copy the players character and all the hairs and stuff they've added to it into StarterPlayer so next time they die they won't spawn as the default character they made but for some reason they spawn as the default character anyway

take a look at my fat script please

local pl = game.Players.LocalPlayer

wait(10)

    if pl and pl.Character then
        local c = pl.Character
        c.Archivable = true
        local clone = c:Clone()
    game.StarterPlayer.StarterCharacter:Destroy()
    clone.Name = "StarterCharacter"
        clone.Parent = game.StarterPlayer
    print("guy has been copied")
    end




my discord Randy Butternubs #7224

2 answers

Log in to vote
0
Answered by 4 years ago

You create the clone but never reset the character. Your script should finish with something like this:

if pl and pl.Character then
        local c = pl.Character
        c.Archivable = true
        local clone = c:Clone()
        game.StarterPlayer.StarterCharacter:Destroy()
        clone.Name = "StarterCharacter"
        clone.Parent = workspace;
        pl.Character = clone;
end

The parent needs to be in the workspace so it exists as a model. You did not previously set the character, so although it was set as the default for the character, you never over-wrote the existing character. Good luck with your game, feel free to ask if you have any more questions.

0
@GriffthouBiff this actually just deletes the players character and does something out of the ordinary, I want it to copy the players character into StarterPlayer because when you put a model named 'StarterCharacter' into StarterPlayer it immediately replaces the players character when they spawn in. I only want this for when they die so the CUSTOMIZATIONS the player had goes onto them when they d THEGOBLINTOPLAD 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

If you want to add it the Character to StarterPlayer right when the player dies then you can use an on death script more about that here. But if you just want to add it to the StarterPlayer then first you need to define the Character

local Character = pl.Character or pl.CharacterAdded:Wait()

We have now defined the character as the character or if the character doesn't exist then wait for it to load then define it. Now we need to copy the Character to StarterPlayer

local Character = pl.Character or pl.CharacterAdded:Wait()
local CharacterClone = Character:Clone()
CharacterClone.Parent = game.StarterPlayer

Now we defined the clone that we cloned using the built in function :Clone() and parented it to StarterPlayer.

Hope I helped, Have a good day! :)

Answer this question