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

Why does this stop working after I respawn even though its a CharacterAdded function?

Asked by
LawlR 182
6 years ago
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
        repeat wait(.1) until chr:IsDescendantOf(game.Workspace)

        --Shirt
        if chr:FindFirstChild("Shirt") == nil then
            local shirt = Instance.new("Shirt",chr)
            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=132601069"
        elseif chr:FindFirstChild("Shirt") then
            chr.Shirt:Destroy()
            local shirt = Instance.new("Shirt",chr)
            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=132601069"
        end

        --Pants
        if chr:FindFirstChild("Pants") == nil then
            local Pants = Instance.new("Pants",chr)
            Pants.PantsTemplate = "http://www.roblox.com/asset/?id=132601229"
        elseif chr:FindFirstChild("Pants") then
            chr:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=132601229"
        end

        --Hats
        for i,v in pairs(chr:GetChildren()) do
            if v.ClassName == "Accessory" then
                v:Destroy()
                else
            end
        --Body Color    
            if v.Name == "Body Colors" then
                v.HeadColor = BrickColor.new("Baby blue")
            end
        end 

    end)    
end)

It works when I press play but then if I reset, it only sets the pants and shirt, and doesn't get rid of the accessories nor makes my head blue. Why?

0
yeah my post was about the appearance too LuckiestJade -5 — 6y
0
output errors? Le_Teapots 913 — 6y
0
Nope. No output errors. LawlR 182 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Make sure you're character auto loads is set to false

0
your* LuckiestJade -5 — 6y
0
StarterPlayer properties LoadCharacterAppearance shouldn't be ticked. LuckiestJade -5 — 6y
0
Nvm I fixed it. Just made it wait a bit longer. LawlR 182 — 6y
0
But yeah you just reminded me about LoadCharacterAppearance. I'm gonna un-tick that now. LawlR 182 — 6y
0
Exacly, LoadCharacter() respawns your character instantly, as I stated clearly. Np LuckiestJade -5 — 6y
Ad

Answer this question