Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Converting Catalog id to Template id in clothing?

Asked by
oggy521 72
6 years ago

In roblox, each article of clothing annoyingly contains two separate ids, one for the catalog and another for the shirt template. In roblox studios, to give a humanoid a shirt, one uses the shirt template id. However, players usually use the catalog id when searching for clothes. This isn't much of a problem if a player were to manually insert a piece of clothing to a player as studios automatically converts the catalog id to the template id as soon as enter is pressed, however, if one were to implement a script where a catalog id is inserted, and given to the player as a template id, it would not automatically be converted, thus the player's shirt would not change. Therefore I ask, is there any possible way to convert a catalog id to a template id with reasonable ease without having to scroll through every decal in the library to see if one matches up with the catalog shirt.

0
I recommend using the insertservice for this, it loads an asset (inside a model) using the id https://wiki.roblox.com/index.php?title=API:Class/InsertService/LoadAsset User#20388 0 — 6y
0
Are you sure it works with shirts? Such as in Player.Character.Shirt.ShirtTemplate = ____ oggy521 72 — 6y

1 answer

Log in to vote
0
Answered by
iRexBot 147
6 years ago

You cannot have an existing clothing then put the clothing ID in it even if you use "rbxassetid://" that wouldn't work. Instead you need to use LoadAsset[https://wiki.roblox.com/index.php?title=API:Class/InsertService/LoadAsset]. Here is a script

local plr = game:GetService("Players")["PLAYER NAME HERE"]
local model = nil
local succ, err = pcall(function()
    model = game:GetService("InsertService"):LoadAsset(CLOTHING ID HERE)
end)
if succ then
    if model:FindFIrstChild("Shirt") then
        model:FindFIrstChild("Shirt").Parent = plr.Character
        model:Destroy()
    end
else
    warn("Could not load clothing. Error: " .. err)
end
0
Changing the id of an existing clothing does work, however, you need to insert the template id rather than the catalog id, But ok, I'll try the load asset method oggy521 72 — 6y
0
But looking again, I would rather find a way to convert catalog id to to template id as it would be much easier and won't involve bringing random models and it'll also allow easier change of clothing oggy521 72 — 6y
Ad

Answer this question