Why dont it work?

Can somebody help me because of this issue when someone join it change shirt but after they respawn it wont not work again.

game.Players.PlayerAdded:Connect(function(player)
	pcall(function()
		local Character = player.Character or player.CharacterAdded:Wait()
		repeat wait(5) until Character.Shirt and Character.Pants
		local shirt = Character:WaitForChild("Shirt")
		local pants = Character:WaitForChild("Pants")

		shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=7542268577"
		pants.PantsTemplate = "http://www.roblox.com/asset/?id=7535967618"

	end)
end)

Try using CharacterAdded event
like this

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		-- the code, make sure to use "if statments" if a player doesn't wear a  shirt or pants
	end)
end)

Or try overwriting player choice from the game settings, its better than doin all of this

2 Likes