Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

6 comments

0

The parent argument to Instance.new is deprecated. You have to own the clothing so it works i believe.

1

aww...

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.

1

ok

1

diddn't work

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

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.