Code issues - The player does not equip clothes

What am i doing wrong?
I have bought clothes in the catalog and I did the programming in roblox studio so that the character wears the clothes but it does not work, what is wrong?

Link here:
(29) RPGSayerShirt - Roblox

image

localscript:

class2.MouseButton1Click:Connect(function()

game.ReplicatedStorage.c2:FireServer()

end)

serverscript:

-- INTO: Class 2
local event = game.ReplicatedStorage.c2
event.OnServerEvent:Connect(function(ff)
	
	local char = ff.Character
	char:findFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=6278158265"
	
end)

could someone help me pls

Hey,

all links to image/decal assets which you want to use in your games have to be using this format:
rbxassetid:// and then the ID after. This part:

image

i did that and still not working :frowning:

local event = game.ReplicatedStorage.c2
event.OnServerEvent:Connect(function(plr)
	
	local char = plr.Character
	char:findFirstChild("Shirt").ShirtTemplate = "rbxassetid://6278158265"
	
end)

it didnt change

image

You need to use the Shirt object, not the other one that is an T-Shirt

how i could do that? ? i am not sure

Instance.new("Shirt",workspace)

And parent the Shirt to the character

Hey, I went looking into this as from experience, I’ve seen many who’ve struggled with inserting clothing in games.

So I went ahead and made this little function for you and you won’t even have to worry about what template to use or anything.

function GetShirtTemplate(ShirtLink)
	local assetId = tonumber(string.match(ShirtLink, "%d+") or 0)  -- Extract the number
	return game:GetService("InsertService"):LoadAsset(assetId).Shirt.ShirtTemplate
end

How I’d use it would be something like this:

Character.Shirt.ShirtTemplate = GetShirtTemplate("rbxassetid://6278158265")
1 Like

Thanks you a lot!! it works :smiley: