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

How do you give Players Custom Armour/Shirt on spawn?

1 answer

✓ Accepted answer

Lets tackle your first problem about changing the Player's Shirt and Pants. Firstly, We'll need to decide the event we need to use to call the script. I suggest CharacterAdded event since it calls the script everytime a Player's Character respawns.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
	print(character.Name.." Has respawned!")
--Code 
	end)
end)

Now we have that done, we'll now need some way to access the Player's Character but luckily for us this is easier then is sound since we could use Parameters to access the Player's Character.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
	print(character.Name.." Has respawned!")
local Shirt =  character:FindFirstChild("Shirt")--This make sure if the Player's Character has a Shirt in the first place.
	if Shirt then 
	Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=60610281"-- Replace the Id with your desired Shirt Id
		
		end
	end)
end)

Since you know how to change the Player's Shirt, you can now do the same thing for the Pants or even T-shirt.

Now for attaching the "Armor" to the Player's Character. Only way you can do this is by welding the Armor to the Player's body part.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
local Armor  = Instance.new(Part, character)-- Using Instance we created a Part and parented it inside the Player's character.
local Armor.CFrame = character["Left Leg"].CFrame --For the welding process we'll need to Make the Part contact with the Player so the weld doesn't break.
local Weld =  Instance.new("Weld" , Armor)--We have created our weld and now we are Parenting it to the Armor
	Weld.Part1 = character["Left Leg"]--Connect the Part1 property of the Weld to the Player's left leg
	Weld.Part0 = Armor--Connect the Part0 property of the Weld to the Armor
	end)
end)

I'm not going to completely show you how Weld each Parts to each "body parts" since that would be pointless because you can use what you learnt to apply it to other body parts.

1 comment

0

Or you could have done a loop for each part of the character's parts doing the same thing?

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