Removing all hats and clothes from a player before adding custom body colours. It removes hats and clothes but fails to add body colours. I may be going about this the wrong way but this is the simplest I can see.
game.Players.PlayerAdded:connect(function(plr) plr.CanLoadCharacterAppearance = false lbbc = game.Lighting["Body Colors"] local bbc = lbbc:clone() bbc.parent = game.Workspace.plr end)
You error is line 5. parent
should be capitalized, but the main problem is game.Workspace.plr
. plr
is a parameter of the PlayerAdded event which is equal to the player that joined the game. It is not a string equal to the player's name, it is equal to the player itself. But even if it was equal to the player's name, it still wouldn't work! That is because, when you use the dot (.
) to look for a child of an object, it does not take strings. You could do game.Workspace[plr.Name]
with brackets, but since a player has a Character property, why not just use that?
game.Players.PlayerAdded:connect(function(plr) plr.CanLoadCharacterAppearance = false lbbc = game.Lighting["Body Colors"] local bbc = lbbc:Clone() bbc.Parent = plr.Character end)
Cheers Perci1 for the help. I tried your suggestion and I didn't work but it did not though a error. So I investigated into the .Character more and added a extra line of code to make it work!
game.Players.PlayerAdded:connect(function(plr) plr.CanLoadCharacterAppearance = false lbbc = game.Lighting.BodyColors local bbc = lbbc:Clone() plr.CharacterAdded:wait() -- Added this bit! bbc.Parent = plr.Character end)