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

[SOLVED] How can I make this character changing script execute when a player completely loads?

Asked by 9 years ago

I'm using this in a singleplayer game. It works in solo mode and server in studio, but not in an actual server. Everything but the shirt and pants appear. Is the loading time of a character even important in getting this to work properly?

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(c)
        wait(3)
        for i,v in pairs(c:GetChildren()) do
            if v:IsA("Hat") then
                v:remove()
            end
            if v:IsA("CharacterMesh") then
                v:remove()
            end
        end
        local q = game.ServerStorage.MessySpikes:clone()
        c.Head.face.Texture = "http://www.roblox.com/asset/?id=13038247"
        q.Parent = c
        for i,v in pairs(c:GetChildren()) do
            if v:IsA("Part") then
                 v.BrickColor = BrickColor.new("Pastel brown")
            end
        end
        local r = c:FindFirstChild("Shirt")
        if r ~= nil then
            r.ShirtTemplate = "rbxassetid://150565172"
        else
            local y = Instance.new("Shirt")
            y.Parent = c
            y.ShirtTemplate = "rbxassetid://150565172"
        end
        local m = c:FindFirstChild("Pants")
        if m ~= nil then
            m.PantsTemplate = "rbxassetid://150515287"
        else
            local t = Instance.new("Pants")
            t.Parent = c
            t.PantsTemplate = "rbxassetid://150515287"
        end
    end)
end)
0
Try setting "CanLoadCharacterAppearance" to false then loading all of your assets when the character loads. More information on the Player page in the wiki. GoldenPhysics 474 — 9y
0
Also you could use CharacterLoaded in a nested function. XtremeSpy 80 — 9y
0
CanLoadCharacterAppearance worked great! Thank you very much! TwentyOneMau5e5 5 — 9y

Answer this question