Team Uniform Script error

So I found this free model script that basically removes the player’s normal clothes and gives them the team’s clothes. But for some reason, if I use a StarterCharacter, the script doesn’t work. There are no errors in the output. Help?

function CleanPlayer(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v:IsA("Shirt") or v:IsA("Pants") then
			v:Destroy()
		end
	end
end

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		repeat wait() until Player:HasAppearanceLoaded() and Character:FindFirstChild("Body Colors")
		CleanPlayer(Character)
		
		for i,v in pairs(script:GetChildren()) do
			if Player.Team.Name == v.Name then
				for i,Clothes in pairs(v:GetChildren()) do
					Clothes:Clone().Parent = Character
				end
				break
			end
		end
	end)
end)

Putting it in ServerScriptService instead should fix the issue. Let me know if it does or doesn’t.