Team clothes | Pants bug


image

pnts = script.Pants
shirt = script.Shirt

function GiveClothes(character)
	if not character:findFirstChild("Shirt") then 
		shirt:Clone().Parent = character
	else character:findFirstChild("Shirt"):Destroy()
		shirt:Clone().Parent = character
	end

	if not character:findFirstChild("Pants") then 
		pnts:Clone().Parent = character
	else character:findFirstChild("Pants"):Destroy()
		pnts:Clone().Parent = character
	end
end

game.Players.PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(char)
		local plr = game.Players:findFirstChild(char.Name)
		print(char.Name)

		if plr.TeamColor ~= BrickColor.new("Deep orange") then 
			return
		else GiveClothes(char)
		end
	end)
end)

This script should dress the players from the team in clothes, he only wears a shirt, but no pants

2 Likes

Does anything in the output come up related to the script?

Are you sure that the pants have a valid ID? Maybe the pants didn’t fully upload yet when you took the screenshot?