Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Clothing script help? NOT ANSWERED

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

0

You don't have to wait for the character after using the CharacterAdded event, it does it for you.

0

Also to remove a character's appearance do plr:ClearCharacterAppearance() in your PlayerAdded function, it's a lot easier than doing all of that.

0

but it wouldnt affect the script. How would I get the clothing to load?

0

It would help you find where the problem. Also check if you can wear the clothing.

0

Ik you can wear the clothing but it says it failed to resolve texture or something like that.

0

It must be a Roblox error then.

0

how would I fix that? Its so annoying

0

You might be able to find a way around it, sorry I can't I'm on a mobile

1 answer

It it most likely outputting "failed to resolve texture format." because it could not find a valid texture, try subtracting 1 from the id of the clothing then try again.

This discussion is preserved as it was. New answers, comments, and votes are closed.