How can I make a script where players can try on clothes. For example the games where you can buy clothes and then you automatically have them. Every single time I try to do it I fail and the player’s pants are gone. Here is an attempt:
local PPS = game:GetService("ProximityPromptService")
local Main = require(script.Parent:WaitForChild("ModuleScript"))
local shirt = char:WaitForChild("Shirt")
local pant = char:WaitForChild("Pants")
pant.PantsTemplate = "http://www.roblox.com/asset/?id=398633812"
Are you using the actual assetId, or the Roblox link?
Try the following: http://www.roblox.com/asset/?id=398633811 for the PantsTemplate property. (I inserted 398633812 into PantsTemplate and then Roblox automatically gives you the AssetId and not the Roblox link.)
Also it may be becayse you’re doing local pant = char:WaitForChild("Pants"), if the player doesn’t have any pants equip that will yield forever as they don’t have any pants on. To counteract this you could use :FindFirstChild to see if they have pants, if they don’t you could create new pants, parent to the character, and then add the assetId to the pants.
Well, not always. It depends on the actual asset id of the clothing. When you upload a piece of clothing to the platform, two main things are generated.
The actual shirt, which you can sell. When you go on the shirt catalog you see this.
As well as the actual asset id of the shirt. The asset id of the shirt is what controls what the shirt actually looks like.
In the case of yours, the asset id was just one away but this isn’t always the case. If you want to find the asset Id, in studio, paste the shirt id / pant id (not the full link, just the ID) into a shirt / pant object. Roblox will automatically translate this to the asset id, however in a script, you’re setting a direct value meaning this won’t actually occur.
I’ve been told I’m pretty bad at explaining things, so if you’re still confused let me know, or possibly someone else can chime in if you don’t understand.