Asset ID changes for some reason

I want to make the server script to change pants on a rig into an pants with id given by the user.
Everything works besides that id changes for some reason. For ex.
129459077 changes 129459076 if you paste it yourself into pantstemplate, and it works. But the script doesnt change this id and it just leaves rig without the clothing
this is my script setting template:

	local product =MarketplaceService:GetProductInfo(id, Enum.InfoType.Asset)
	if product.AssetTypeId == 12 then
		rig:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=".. id

I checked with printing and it doesn’t change at any point.

Any ideas on how to get it to work?

Studio does automatically set Clothing to their corresponding Image ID. Ths doesn’t automatically work on dev-scripts. there’s a method with InsertService:LoadAsset(PantsID) and continuing from there but I forgot the exact steps.

1 Like

where in documentation can I find this method?

The method can be found on the DevForum

1 Like
Asset = game:GetService("InsertService"):LoadAsset(id)
print(Asset.Pants.PantsTemplate) -- This would be what you would use
1 Like

Thanks guys! It works now! Can i mark 2 anwsers as Solve? Both of them helped me very much.

Mark @SomeFedoraGuy 's reply, I’m just providing the method he mentioned.

2 Likes

Okay, but thank you very much too!

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