[solved] Clothing does not appear after changing IDs

Hey there,

I’m trying to figure out why when I change the player’s clothing, it just makes the player’s clothes go poof. (the clothes are still there, but it either doesn’t load or I don’t know what’s happening) Yes, the IDs are correct. itemid and itemid2 just links to a variable, so that’s all correct. Does anyone know what’s going on? (player is a variable as well, so don’t worry about that)

No, there’s nothing in the output.

Here’s my script:

    local character = player.Character
    if character then
        local shirt = character:FindFirstChildOfClass("Shirt")
        local pants = character:FindFirstChildOfClass("Pants")
        
        if not shirt then
            shirt = Instance.new("Shirt")
            shirt.Name = "Shirt"
            shirt.Parent = character
        end
        
        if not pants then
            pants = Instance.new("Pants")
            pants.Name = "Pants"
            pants.Parent = character
        end
        
   
        shirt.ShirtTemplate = "http://www.roblox.com/asset/?id="..itemid
        pants.PantsTemplate = "http://www.roblox.com/asset/?id="..itemid2
    end
5 Likes

Before replying, reread the post, there’s a lot of extra info which you could go past

4 Likes

You could try using InsertService, it inserts the shirt ID into a model. This worked for me when I tested it in a game. You can do the same for the pants.

local itemid = script.Parent.Value.Value
local InsertService = game:GetService("InsertService")
local ShirtID = itemid -- ID from catalog
local model = InsertService:LoadAsset(ShirtID) -- it inserts it as a model
model.Shirt.Parent = script.Parent -- Or just get the model.Shirt.ShirtTemplate and set the Character's ShirtTemplate to that

I got this info from this post

3 Likes

How can you insert a shirt as a model? Keep in mind these are classic shirt and pants ^^

4 Likes

I used a classic shirt and it worked fine

Basically, it takes the ShirtID from the catalog and makes it an actual asset in-game using the catalog shirt id. You can read about it here

So I have a dummy without clothes, and when I run the game, the shirt with the ID I chose becomes a child of the dummy, giving him the shirt.

3 Likes

Okay, I’ll try that tomorrow as it’s already pretty late for me, thanks

5 Likes

I don’t think it’s possible, seen as you can’t change meshID’s or textureID’s on meshparts, I guess it works the same.

I guess an alternative is to delete the clothing (create a copy if they’re ever going to wear it again without respawning) and create an instance with the said ClothingTemplates which are going to parent to the character.

1 Like

100% forgot to mention, this is a local script, quite sure loadasset doesn’t work on the client

Personally I have no idea why this is happening, this should’ve been very simple but the clothes look like they’re not loading in, even though there’s nothing in the output telling that and the clothes are still on Roblox & wearable

2 Likes

In that case, there isn’t a lot you can do. What you need to do is use the template ID of the shirt, not the catalog ID.

I agree, this really should be simpler.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.