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

How do I clear character appearance and set the same avatar for all players in my game?

Asked by 6 years ago
Edited 6 years ago

Here is the script I did, but it's not working and isn't changing the avatar, but is clearing the appearance.

game.Players.LocalPlayer.Character.ChildRemoved:connect(function(child)
  print(child.ClassName, 'removed from character')
end)



game.Players.LocalPlayer:ClearCharacterAppearance()
--> BodyColors removed from character
--> ShirtGraphic removed from character
--> Shirt removed from character
--> Pants removed from character
--> CharacterMesh removed from character
--> Hat removed from character
--> Shirt removed from character

local player = game:GetService("Players").LocalPlayer -- Gets the clients player

player.CharacterAppearanceLoaded:Connect(function() -- Fires when all assets on character is loaded
    game.Players.LocalPlayer:ClearCharacterAppearance() -- Clears Appearance
    for _,BodyPart in pairs(player.Character:GetChildren()) do -- Loops through the characters body
        if BodyPart:IsA("BasePart") then -- Checks if the BodyPart variable is an actual part
            BodyPart.BrickColor = BrickColor.new("Black") -- Changes the body part to Bright Yellow
        end
    end
end)
game.Players.PlayerAdded:connect(function(player) -- Hat adder
    repeat wait()until player.Character
    local hatId = 168167370 -- Find the ID of the hat
    local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
    hat.Parent = player.Character
end)

game.Workspace.ChildAdded:connect(function(plr) --Pants and body adder
    local name = plr.Name
    local playerinplayers = game.Players:FindFirstChild(plr.Name)
     playerinplayers.CanLoadCharacterAppearance = false
     plr.Head.face.Texture = "rbxassetid://173789498" --Find an ID of a decal for your face.
     local shirt = Instance.new("Shirt", plr)
     shirt.ShirtTemplate = "rbxassetid://295960485" -- Find the ID of the shirt
    local pants = Instance.new("Pants", plr)
    pants.PantsTemplate = "rbxassetid://128946130" -- Find the ID of the pants
end)

game.Players.PlayerAdded:connect(function(player)
    local appearanceOverride = game.Players:FindFirstChild(player.Name)
    appearanceOverride.CanLoadCharacterAppearance = false
end)


0
1) You didn't make that 2) You didn't tell an error/question so we will not answer User#20388 0 — 6y
0
Yes I made that cooldude19774 -54 — 6y
0
You didn't make that script, even if you said you did why is there comments in it? LoganboyInCO 150 — 6y

1 answer

Log in to vote
0
Answered by
Rawblocky 217 Moderation Voter
6 years ago

Well, there is a much more simple way in doing this.

  1. Change your character to what you want it to look like
  2. Play Solo
  3. Select your character in Workspace
  4. Check "Archivable" (in properties tab)
  5. Copy the character
  6. Paste the character in "StarterPlayer"
  7. Name the character "StarterCharacter"

And you're done!

0
How do u copy the character cooldude19774 -54 — 6y
0
nvm cooldude19774 -54 — 6y
Ad

Answer this question