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

How to change the player look when the player enter the game? [closed]

Asked by 8 years ago

I wanna change the player look to look like a noob but I don't know how.Can someone help me?

Closed as Not Constructive by M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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)
Ad