How do I change players looks without getting rid of their features?

So basically I want my character to look different, but without taking out the players’ heads, hats, or legs. A game that goes something like this is “Road to Gramby’s”.
Hat
They take out most of the default avatar and keep the hat, but I just want the legs and head to be there. I’m sorry if this is confusing, I can explain more if someone doesn’t get it.

2 Likes

Do

local hat = workspace.TheModel.TheHat
hat:Destroy()

Idk if that is what you meant…

1 Like
for i, v in pairs(characterModel:GetDescendants()) do
    if v:IsA('BasePart') or v:IsA('BasePart') and v:FindFirstAncestorOfClass('Accessory').AccessoryType ~= Enum.AccessoryType.Hat then
       v:Destroy()
    end
end

Doesn’t work, “characterModel” is causing the error.

No, I want the hats to be on the model.

characterModel is a variable that should be set to the player’s character. He was just giving you a snippet of code.

game.Players.PlayerAdded:Connect(function(player)
      player.CharacterAdded:Connect(function(char)
               for i, v in pairs(char:GetDescendants()) do
                    if v:IsA('BasePart') or v:IsA('BasePart') and v:FindFirstAncestorOfClass('Accessory').AccessoryType ~= Enum.AccessoryType.Hat then
                    v:Destroy()
               end
          end
     end)
end)

Apologies for bad formatting I’m on my phone. This code will change every player’s character as soon as they join the game.

Change “characterModel” to the model which you want to remove the parts of.

Does this take the hats off the avatar, and where do I put the script? StarterCharacterScripts?

The script will not take hats off the avatar. I would recommend putting it inside a ServerScript in ServerScriptService.

Still doesn’t seem to work. When I do it my starter character turns invisible. Here is what the starter character looks like and what the parts are and all that.
F

Try and add on to the if statement checking for the basepart’s name. For example:

and v.Name ~= “Head” and v.Name ~= “HumanoidRootPart” etc…

For any part you don’t want to delete, just add an “and v.Name ~= “PartNameHere”, and it won’t delete that part when starting the game. Do not delete the HumanoidRootPart. The only parts I think you could delete with your character still working is the arms and legs, but nothing else.

I have attempted to try and add on to the if statement, but I can’t figure out how to make it work.

local starterPlayer = game:GetService("StarterPlayer")
local validParts = {
	starterPlayer.StarterCharacter.Lid,
	starterPlayer.StarterCharacter.Torso,
	starterPlayer.StarterCharacter.Head,
	starterPlayer.StarterCharacter.HumanoidRootPart,
	starterPlayer.StarterCharacter.LeftLeg,
	starterPlayer.StarterCharacter.RightLeg
}

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		for i, v in pairs(char:GetDescendants()) do
			if v:IsA('BasePart') or v:IsA('BasePart') and v:FindFirstAncestorOfClass('Accessory').AccessoryType ~= Enum.AccessoryType.Hat
				and v.Name ~= validParts then
				v:Destroy()
			end
		end
	end)
end)

Would I need to change the parts I have done entirely? Also, I am a beginner at scripting so I do not have the best scripting knowledge.

You’d have to have each index of the table along with validParts (v.Name ~= validParts[1]). You would just increase index 1 by 1 for each part in the table.

I got it to work but the hats don’t spawn, but the player turns into something like the model without its humanoid.
Capturesss
Capturessss

Hi!

The code below loops thru every instance and clones them to the dummy if it is an Accessory or a Hat. (I tested with a dummy)

game:GetService("Players").PlayerAdded:Connect(function(plr)
	local character = plr.CharacterAppearanceLoaded:Wait() --Waits until the character appearance is loaded
	local obj = workspace.Char --Replace this with your model (where the hats will be copied)
	for _, i in pairs(character:GetChildren()) do
		if i:IsA("Hat") or i:IsA("Accessory") then --Checks if the instance is either a hat or an accessory
			i:Clone().Parent = obj
			print("Cloned "..i.Name)
		end
	end
end)

Hope this helps

I think you meant cloning the hats to a character/dummy. If this isn’t what you asked for, please tell me what you meant.

Use Humanoid:GetAppliedDescription() to fetch a character’s appearance, then apply the necessary changes and override the character’s appearance with Humanoid:ApplyDescription().

1 Like

It seems like it doesn’t work for me, nothing would change about the character. I have also tried it in a new baseplate but still didn’t work.

Try changing the transparency of the parts instead of destroying them.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		for i, v in pairs(char:GetDescendants()) do
			if v:IsA('BasePart') or v:IsA('BasePart') and v:FindFirstAncestorOfClass('Accessory').AccessoryType ~= Enum.AccessoryType.Hat
				and v.Name ~= validParts then
				v.Transparency = 1
			end
		end
	end)
end)