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

Help w/ when a Character joins game, they have a certain clothing?

2 answers

✓ Accepted answer

So you want the player to have a certain shirt and pants when they join the game.

To accomplish this, we're going to take the original shirts and pants off the player when they join the game. Our code so far would look like this:

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		player.CanLoadCharacterAppearance=false 
	end)
end)	

Next we want to put on the clothes that we want the player to have. Let's make an instance of a shirt and put that as a variable named 'shirt'. Let's also make an instance of pants and put that as a variable named 'pants'.

local shirt = Instance.new("Shirt")
local pants = Instance.new("Pants")

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		player.CanLoadCharacterAppearance=false
	end)
end)	

Take the ID of the shirt and pant you want, found at the end of the URL, and subtract one from it. So if you want this shirt, the shirt template would be http://www.roblox.com/asset/?id=51350913. Let's store these in a variable. The shirt and pant ID used are simply examples. You'll have to change them to whatever you want.

local shirt = Instance.new("Shirt")
local shirtID="http://www.roblox.com/asset/?id=51350913"
local pantID = "http://www.roblox.com/asset/?id=137169695"

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		player.CanLoadCharacterAppearance=false
	end)
end)	

Now we're going to want to put the asset IDs on the templates for the shirt and pants. We're then going to put the shirt and pants on the player's character.

local shirt = Instance.new("Shirt")
local shirtID="http://www.roblox.com/asset/?id=51350913"
local pantsID = "http://www.roblox.com/asset/?id=137169695"

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		player.CanLoadCharacterAppearance=false
		
		shirt.ShirtTemplate=shirtID
		shirt.Parent=player.Character
		
		pants.PantsTemplate=pantsID
		pants.Parent=player.Character
	end)
end)	

There you have it! Sorry if some stuff is confusing. I'm kind of a nooby scripter but I tried my best to help you. Don't forget to vote and select an answer! :)

By the way, "player.CanLoadCharacterAppearance=false" will change the color of the player to the basic "noob" colors. If you need help changing them back or something, just ask and I will try my best to help you.

Well this might help. You know morphs right? Well put a morph in the spawn and hide the body they spawn into away from the map.

Anyway that might help :)

Sincealy Soulzs

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