Hey guys! So I’m trying to rescript an old system of equipping clothing for use with my new system and GUIs. I’m having an issue with this code.
function onClick(mouse)
local playerName = script.Parent.Parent.Parent.Parent.Parent.Name
local id = script.Parent:WaitForChild("ID")
local realID = id.Value
local assetURL = "http://www.roblox.com/asset/?id="
local completedURL = assetURL..realID
local actualPlayer = game.Workspace:FindFirstChild(playerName)
local shirt = actualPlayer:FindFirstChildOfClass("Shirt")
if not shirt then
local shirt = Instance.new("Shirt")
shirt.ShirtTemplate = completedURL
shirt.Parent = actualPlayer
shirt.Name = "Shirt"
else
local shirt = Instance.new("Shirt")
shirt.ShirtTemplate = completedURL
shirt.Parent = actualPlayer
local currentShirt = actualPlayer:FindFirstChild("Shirt")
currentShirt:remove()
shirt.Name = "Shirt"
end
end
script.Parent.MouseButton1Click:Connect(onClick)
When I run it, it does indeed remove the shirt, but returns this error and does not equip my new one, just defaults to my torso presets.
Image “https://assetdelivery.roblox.com/v1/asset?id=2823289578” failed to load in “Workspace.itsokayepic.Humanoid.Clothes”: Request failed
You have to make sure you own/your group owns the clothing, I believe that’s is how it is setup but I could be wrong, I assume it’s the same reason animations fail to load. To “own” the clothing all you need to do is place it in workspace and save it to roblox, which will save it under your name. If you did this, it also takes time for these things to be moderated.
I believe your roblox asset id is wrong, i believe it should be “rbxassetid://“ or something like that, just paste the id into the shirt object and copy the rbxassetid link
Im pretty sure you have to own the shirt. Has anyone else had these problems? If not, you have done something wrong in your script.
I do not really see the error in the script though?
Also, asset id is incorrect.
I don’t believe this is how it works, saving shirts to a model will only save it as just that, a model. You can use any clothes regardless if you own them or not.
My method of concatenating with the assetURL does work, it’s just maybe a little outdated. I believe it may be the issue like y’all stated where if I don’t own the clothes I can’t use it in my model. I’ll see, can anyone else confirm this?
Ok. So it still doesn’t work after having changed my asset URL. I don’t think it’s an issue with me not owning the shirts either, because other models I’ve created have done this with others shirts. Can anyone help?