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

Change shirt script working half of the time?

my change clothing script seems to only work in certain cases with shirts... not sure why though. I tried my script with a shirt from my owned shirts and i subtracted the last digit of the id by 1 and it worked but when i tried it with any other shirt it didnt not work. Any ideas as to why this is happening? At certain times in the output it says "failed to load humanoid.clothes" and other times it just wont say anything in the output but the shirt wont load to the character and idk why.

heres parts of the script

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
     wait()


	if character.CHARACTERRANDOM.Gender.Value == 1 and character.CHARACTERRANDOM.Shirt.Value == 1 then 
			repeat wait() until
			character:FindFirstChild("Body Colors") ~= nil
			if character:FindFirstChild("Shirt") then 
			local Shirt = character.Shirt
			Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=445788392"
			end
			end

1 answer

You may just need a wait()...

        repeat wait() until char:FindFirstChild('Body Colors')~= nil 
        wait(0.35) --Just in case late spawn
        if char:FindFirstChild('Shirt')~= nil then 
            char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=445788392"
..shirtID
        else
            local shirt = Instance.new("Shirt",char)
            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=445788392" 
..shirtId
        end

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