I wanna change the player look to look like a noob but I don't know how.Can someone help me?
How to change the player look when the player enter the game?
1 answer
First, when the player join, use the function PlayerAdded so we know that a player joined.
game.Players.PlayerAdded:connect(function(plr)
end)
The player will be called plr
We don't have the Player's character?! So we must wait for it. Use the function :WaitForDataReady() so we know that the player has loaded.
local Character = plr:WaitForDataReady()
But we still want to remove hats, shirts and pants?
The function :GetChildren() will get every children of the Player's character.
local Children = Character:GetChildren()
Now we have everything, we must sort out the children, the ones we delete and the ones we keep.
for _, Object in pairs (Children) do
if Object:IsA("Shirt") then
Object:Destroy()
elseif Object:IsA("Shirt Graphic") then
Object:Destroy()
elseif Object:IsA("Pants") then
Object:Destroy()
elseif Object:IsA("Hat") then
Object:Destroy()
end
end
if Character.Head:FindFirstChild("roblox") then
Character.Head.roblox:Destroy()
end
All the unwanted stuff like the shirt, the t-shirt, the pant and the hats will be destroyed.
But now, we still need to change the player's character's colors to noob's colors.
if Character:FindFirstChild("Body Colors") then -- We check if it's here
Character["Body Colors"].HeadColor = BrickColor.new("New Yeller")
Character["Body Colors"].LeftArmColor = BrickColor.new("New Yeller")
Character["Body Colors"].RightArmColor = BrickColor.new("New Yeller")
Character["Body Colors"].LeftLegColor = BrickColor.new("Bright green")
Character["Body Colors"].RightLegColor = BrickColor.new("Bright green")
Character["Body Colors"].Torso = BrickColor.new("Bright blue")
end
Everything should work fine, if you have a question ask me! Hope you understand how it works. Entire Code:
game.Players.PlayerAdded:connect(function(plr)
local Character = plr:WaitForDataReady()
local Children = Character:GetChildren()
for _, Object in pairs (Children) do
if Object:IsA("Shirt") then
Object:Destroy()
elseif Object:IsA("Shirt Graphic") then
Object:Destroy()
elseif Object:IsA("Pants") then
Object:Destroy()
elseif Object:IsA("Hat") then
Object:Destroy()
end
end
if Character.Head:FindFirstChild("roblox") then
Character.Head.roblox:Destroy()
end
if Character:FindFirstChild("Body Colors") then -- We check if it's here
Character["Body Colors"].HeadColor = BrickColor.new("New Yeller")
Character["Body Colors"].LeftArmColor = BrickColor.new("New Yeller")
Character["Body Colors"].RightArmColor = BrickColor.new("New Yeller")
Character["Body Colors"].LeftLegColor = BrickColor.new("Bright green")
Character["Body Colors"].RightLegColor = BrickColor.new("Bright green")
Character["Body Colors"].Torso = BrickColor.new("Bright blue")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
