Confused on how to change a character's shirt and pants on respawn

You run script when the character has not load. Try to use this script:

local Players = game:GetService("Players")
local shirtA = "http://www.roblox.com/asset/?id=3261604730"
local shirtB = "http://www.roblox.com/asset/?id=3121940799"
local shirtC = "http://www.roblox.com/asset/?id=766686366"
local shirtD = "http://www.roblox.com/asset/?id=5033783669"
local pantsA = "http://www.roblox.com/asset/?id=3553957176"
local pantsB = "http://www.roblox.com/asset/?id=2005439614"
local pantsC = "http://www.roblox.com/asset/?id=769666482"
local pantsD = "http://www.roblox.com/asset/?id=5033785373"

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		char:WaitForChild("Humanoid").Died:Connect(function()
			plr.CharacterAdded:Wait()
			char:WaitForChild("Shirt")
			char:WaitForChild("Pants")
			local number = math.random(1,4)
			if number == 1 then
				char.Shirt.ShirtTemplate = shirtA
				char.Pants.PantsTemplate = pantsA
			elseif number == 2 then
				char.Shirt.ShirtTemplate = shirtB
				char.Pants.PantsTemplate = pantsB
			elseif number == 3 then
				char.Shirt.ShirtTemplate = shirtC
				char.Pants.PantsTemplate = pantsC
			elseif number == 4 then
				char.Shirt.ShirtTemplate = shirtD
				char.Pants.PantsTemplate = pantsD
			end
		end)
	end)
end)

EDIT: Your shirt and shirt URL is wrong.

1 Like