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

How do I fix clothes not showing up when I change them through a script?

Asked by 5 years ago
Edited 5 years ago

Every time I use my script to change the clothes someone is wearing when they press a gui button it returns this error in my output window:

16:29:44.153 - Image "https://assetgame.roblox.com/asset/?id=2186701982" failed to load in "Workspace.Oxygen4Lyfe.Humanoid.Clothes": Request failed
16:29:44.175 - Image "https://assetgame.roblox.com/asset/?id=952303920" failed to load in "Workspace.Oxygen4Lyfe.Humanoid.Clothes": Request failed

It keeps failing to load the asset for the clothes even though the clothes are not removed from Roblox, the code is run through a remote event, and the clothing templates do change in both the pants and shirt.

Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "ChangeOutfitTo1Event"

local function onChangeOutfitTo1Fired(player)
    local shirt = player.Character.Shirt
    local pants = player.Character.Pants
    shirt.ShirtTemplate = "rbxassetid://1541143359"
    pants.PantsTemplate = "rbxassetid://1541144106"
    print("Changed "..player.Name.."'s outfit to outfit 1!")
end

createPartEvent.OnServerEvent:Connect(onChangeOutfitTo1Fired)

Shirt: https://www.roblox.com/catalog/1541143359/Alterra-Radiation-Suit

Pants: https://www.roblox.com/catalog/1541144106/Alterra-Radiation-Suit

I have tried using the full urls instead of "rbxassetid://", but it makes no difference. If anybody could supply a solution I would very much appreciate it.

0
The parent argument to Instance.new is deprecated. You have to own the clothing so it works i believe. User#19524 175 — 5y
1
aww... Oxygen4Lyfe 408 — 5y
0
At the 2nd line of the script, remove the 2nd argument. Now add this new line below the 2nd line: `createPartEvent.Parent = ReplicatedStorage`. I am not sure if this totally fix it but it fixes the deprecated code. valchip 789 — 5y
1
ok Oxygen4Lyfe 408 — 5y
View all comments (2 more)
1
diddn't work Oxygen4Lyfe 408 — 5y
0
No, you do not need to own the clothing. The reason it is not working is because you are not using the clothing's template id, you are using the clothing asset itself. For instance instead of using 1541144106 you would use 1541144101 Vulkarin 581 — 5y

1 answer

Log in to vote
1
Answered by 3 years ago

Nevermind this question is old

Ad

Answer this question