I made a script that will load a player's clothing based on their teams. The script works but the Clothing doesnt load. It sometimes says in the output "failed to resolve texture format." or something like that. This is the script.
--Realy simple function to remove an item
function rmItm(char, itm)
--waits for the item just in case
while not char:WaitForChild(itm) do wait() end
--finds the item
local item = char:FindFirstChild(itm)
--removes the item
item:remove()
end
--New player
game.Players.PlayerAdded:connect(function (plr)
print("Player Added:- " .. plr.Name)
--character load
plr.CharacterAdded:connect(function (char)
--wait for character but clothes do not load??
while char == nil do wait()end
print("Player Sporned:- " .. char.Name)
wait(5) --dont know how to wait for all of the character to load? shirt not present with other waiting methods?
--lopp through all of the characters incase they have multiple hatz etc.
for _,v in pairs(char:GetChildren()) do
--character item v class check to see what it realy is just in case the name is wrong
if v:IsA("Shirt") or v:IsA("Hat") or v:IsA("Pants")then
rmItm(char, v.Name)
print("Removed:- " .. v.Name)
end
end
--All done
print("Player cleaned")
--I dont know if this will work as i dont have the rsources to test this
if plr.TeamColor == game.Teams["Atlas"].TeamColor then
shirt3 = script.Clothing2:clone()
shirt4 = script.Pants2:clone()
shirt3.Parent = char --Clones and equips the new uniform
shirt4.Parent = char
end
end)
end)

8 comments
You don't have to wait for the character after using the CharacterAdded event, it does it for you.
Also to remove a character's appearance do plr:ClearCharacterAppearance() in your PlayerAdded function, it's a lot easier than doing all of that.
but it wouldnt affect the script. How would I get the clothing to load?
It would help you find where the problem. Also check if you can wear the clothing.
Ik you can wear the clothing but it says it failed to resolve texture or something like that.
It must be a Roblox error then.
how would I fix that? Its so annoying
You might be able to find a way around it, sorry I can't I'm on a mobile