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

Changing default character appearance?

Asked by 7 years ago

So I wrote this script which changes the character appearance in game. The only problem is that it will only work when I reset. Before I reset, the clothes are already here but not the skin colors and face. Also, the my hats aren't removed until I reset. So basically I need it to so once I enter the game, it automatically changes my appearance without me having to reset.

game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Head.face.Texture = "rbxassetid://64064193"
local bodycolors = Instance.new("BodyColors", plr)
bodycolors.RightArmColor = BrickColor.new("Cashmere")
bodycolors.LeftArmColor = BrickColor.new("Cashmere")
bodycolors.LeftLegColor = BrickColor.new("Cashmere")
bodycolors.RightLegColor = BrickColor.new("Cashmere")
bodycolors.TorsoColor = BrickColor.new("Cashmere")
bodycolors.HeadColor = BrickColor.new("Cashmere")
local shirt = Instance.new('Shirt',plr)shirt.ShirtTemplate = "rbxassetid://276318635"
local pants = Instance.new('Pants',plr)pants.PantsTemplate = "rbxassetid://276318699"
end
end)

2 answers

Log in to vote
1
Answered by 7 years ago
game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function()
        Player.CharacterAppearanceLoaded:connect(function()
            local Character = Player.Character
            local Head = Character.Head
            local BodyColors = Character:FindFirstChild("Body Colors")
            local Shirt = Character:FindFirstChild("Shirt")
            local Pants = Character:FindFirstChild("Pants")
            if Shirt then
                Shirt.ShirtTemplate = "rbxassetid://276318635"
            else
                local Shirt = Instance.new("Shirt", Character)
                Shirt.ShirtTemplate = "rbxassetid://276318635"
            end
            if Pants then
                Pants.PantsTemplate = "rbxassetid://276318699"
            else
                local Pants = Instance.new("Pants", Character)
                Pants.PantsTemplate = "rbxassetid://276318699"
            end
            for i, v in pairs(Character:GetChildren()) do 
                if v.ClassName == "Hat" then v:remove()
                else
                end
            end
            Head.face.Texture = "rbxassetid://64064193"
            BodyColors.RightArmColor = BrickColor.new("Cashmere")
            BodyColors.LeftArmColor = BrickColor.new("Cashmere")
            BodyColors.LeftLegColor = BrickColor.new("Cashmere")
            BodyColors.RightLegColor = BrickColor.new("Cashmere")
            BodyColors.TorsoColor = BrickColor.new("Cashmere")
            BodyColors.HeadColor = BrickColor.new("Cashmere")
        end)
    end)
end)
Ad
Log in to vote
0
Answered by 7 years ago

This runs everytime something is added into workspace..try playeradded event instead

Answer this question