Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i put clothing on a player when the player joins?

When the player enters the game how do i make them wear a outfit that i choose?

2 answers

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
for i,v in pairs (character:GetChildren() do
if v.ClassName == "Shirt" or v.ClassName == "Pants" then
v:remove()
end
end
local Shirt = put shirt destination here:Clone()
Shirt.Parent = character
local Pants = put pants destination here:Clone()
Pants.Parent = character
end)
end)

1 comment

0

indent pls

shirtid = -- put number of shirt in here
pantsid = -- put number of pants in here

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
if character:findFirstChild("Shirt") ~= nil then
character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..shirtid
else
local newshirt = Instance.new("Shirt")
newshirt.Parent = character
newshirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..shirtid
end
if character:findFirstChild("Pants") ~= nil then
character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id="..pantsid
else
local newpants = Instance.new("Pants")
newpants.Parent = character
newpants.PantsTemplate = "http://www.roblox.com/asset/?id="..pantsid
end
end)
end)

Accept if helped

4 comments

0

me and your answer is basically the same, but yours is just longer.

0

@Nikkulai His solution is a bit better. If only he used non-deprecated stuff and some indentation, his answer will be perfect.

0

yes lol

0

I made my one easier to understand you just have to type the number in where it says shirts id and pants id at the top

This discussion is preserved as it was. New answers, comments, and votes are closed.