Currently messing around making a character customizer, but whenever I enter a Clothing ID, instead of applying it, the clothing itself just goes invisible

Here’s the code I use for it:
sg.CustomShirt.TextBox.FocusLost:Connect(function()
local id = sg.CustomShirt.TextBox.Text
local succ = pcall(function()
rig.Shirt.ShirtTemplate = string.format("http://www.roblox.com/asset/?id=%s",id)
end)
if succ then
data.Outfit.Shirt = string.format("http://www.roblox.com/asset/?id=%s",id)
end
end)
Any suggestions?
Try printing the id and if its nil then there’s the problem
Lets see did you try to use rbxassetid:// instead of the website URL
Also Shirt.ShirtTemplate property specifically expects the id of a shirt asset if your provide the id of lets say a decal (often used for tshirts on the front of a torso) or any other asset type,it wont render correctly on the shirt object
I get the same result with rbxassetid://
It prints the correct ID, with both the rbxassetid:// and with the one I have above
becouse you apply clothing ID instead of it’s image ID
Grab decal’s Texture property that you inserted through InsertService
Validate ID with AssetService | Documentation - Roblox Creator Hub first tho
Dont forget to clean up mess that InsertService does tho
I’m pretty sure you need to use the decal ID.
Also make sure you try preloading them like this (Local script inside replicatedfirst):
local preloadedImages = {}
preloadedImages = {
--Ur ids blablabla
}
local function checkFailed(contentId, Status)
if Status == Enum.AssetFetchStatus.Failure then
print("Failed to load", contentId .. "trying to reload..")
end
end
ContentProvider:PreloadAsync(preloadedImages, checkFailed)
The clothing isn’t being inserted VIA insert service though, I’m just taking the ID and putting it into the x-template property… I don’t see how InsertService would be used here
I may have implemented this incorrectly, but can you elaborate some more on what this does exactly?

Nevermind I got it working, this was actually the solution, ty!
Here’s the code I used incase you have any optimization suggestions (server-sided code):
local function loadClothes(id)
local cloth = game.InsertService:LoadAsset(id)
local returnID = nil
if cloth:FindFirstChild("Shirt") then
cloth = cloth:FindFirstChild("Shirt")
returnID = cloth.ShirtTemplate
cloth.Parent:Destroy()
elseif cloth:FindFirstChild("Pants") then
cloth = cloth:FindFirstChild("Pants")
returnID = cloth.PantsTemplate
cloth.Parent:Destroy()
end
return returnID
end
script.Parent.InsertClothes.OnServerInvoke = function(plr,id)
local returnID = loadClothes(id)
return returnID
end
1 Like