Roblox Clothing Asset Faild Request

I have a line of code that’s suppose to set the player’s clothing but instead it errors out with, "Request Failed"
code:

  plr.Character:WaitForChild("Shirt").ShirtTemplate = "rbxassetid://"..tuple[2] --tuple[2] is indeed a valid Shirt Id, I've double checked

How can I fix this? By the way I cant set a manual link this HAS to be automated!

1 Like

Try using the image of the shirt template instead of the actual shirt asset (like how you use images in GUI objects).

Also make sure the asset hasn’t been moderated.

That’s the problem though, I can’t this has to be automated as a user is putting a clothing ID through the system… Currently the current clothing ID being put in through the tuple is a existing clothing item.

Does it work using the shirt ID for other shirts? Or is this an issue occuring for all clothing?

And yeah in that case you’d want to do a search for methods of getting the image ID of an asset

All clothing.

https://devforum.roblox.com/t/how-to-get-the-image-id-of-a-shirt-created-by-a-group/26257/2

Two solutions:

  • Load the asset using InsertService (probably the best one for this, as its creating the shirt object for you too - all you need to do is parent it)
  • Do a web request (assetgame.roblox.com/asset/?id=<id>) and get the ShirtTemplate value from the returned XML
7 Likes

Thanks @EmeraldSlash, InsertService did the trick.

 	local c = game:GetService("InsertService"):LoadAsset(tuple[2])
	c.Parent = plr.Character
	c.Shirt.Parent = plr.Character

However, there is a model that get’s left over, But that doesn’t really effect anything so it’s not a problem!

1 Like

Yeah, that’s just normal InsertService behaviour. Destroying it is fine.

1 Like
local InsertService = game:GetService('InsertService')

function GetTemplate(assetId)
	local template
	local success, errormsg = pcall(function() 
		local obj = InsertService:LoadAsset(assetId):GetChildren()[1]
		if obj then
			if obj:IsA('Shirt') then
				template =  obj.ShirtTemplate
				obj:Destroy()
			end
		end
	end)
	if success then
		return template
	else
		return 'ERROR: '..errormsg
	end
end
local ShirtTemplate = GetTemplate(assetId)

Oops, a little too late, but here’s a function I whipped up that’d do the trick. :stuck_out_tongue:

8 Likes