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

Cannot set player's shirt, help?

Hey, so, I've been trying to make a GUI that swaps the player's shirt to the ID put in, here's the code, as the script is basically another 300 lines of other code, I'll only be posting a small snippet:

customItems.Submit.MouseButton1Click:Connect(function()
	if string.len(customItems.CustomID.Text) ~= 0 then
		if string.sub(customItems.Header.Text, 8) == "SHIRT" then
			print("shirt ID")
			local char = game.Players.LocalPlayer.Character
			if char ~= nil then
				local shirtToChange = char:FindFirstChild("Shirt")
				if shirtToChange ~= nil then
					local mplace = game:GetService("MarketplaceService")
					local exists = pcall(function()
						mplace:GetProductInfo(customItems.CustomID.Text)
					end)
					if exists then
						print("Shirt changed")
						shirtToChange.ShirtTemplate = "rbxassetid://".. mplace:GetProductInfo(customItems.CustomID.Text).AssetId
					end
				else
					shirtToChange = Instance.new("Shirt", char)
				end
			else
				print("Player no longer exists")
			end
		elseif string.sub(customItems.Header.Text, 8) == "PANTS" then
			print("pants ID")
			
		else
			error("No type of ID was set for CustomID")
		end 
	else
		print("Not long enough ID")
	end
end)

The error thrown is:

16:44:26.458 - Image "https://assetgame.roblox.com/asset/?id=2034242601" failed to load in "Workspace.RaggaMuffinzz.Humanoid.Clothes": Request failed

2 comments

0

try to test ingame?

0

I already have

1 answer

Hello,

The reason it doesn't work is because you are trying to link a product in the catalog rather than linking the actual texture.

The actual texture will look like this: Imgur

~Frag

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