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

How to load hats onto a character?

Asked by 7 years ago

So recently I've been working on loading hats from the catalog to a character so they can wear it. I found a script from an old scripting helpers post and it worked. But when I tried it out in Roblox Player, it said it was broken and made me refer to this site http://devforum.roblox.com/t/coming-changes-to-insert-service/30327.

Apparently they had changed everything so that exploiters would exploit and stuff. I didn't understand what UristMcSparks was talking about in the link so I came here. Here's my script that broke.

local plr = game.Players.LocalPlayer
local button = script.Parent
local hatId = 16179349
button.MouseButton1Down:Connect(function()
repeat wait()until plr.Character
hatId = 16179349
if plr ~= nil then
local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
hat.Parent = plr.Character
script.Parent.Text = "Selected"
script.Parent.TextScaled = false
script.Parent.TextSize = 20
script.Parent = nil
end
end)

If anyone knows an answer please respond to me thanks :)

0
This is a localscript in a textbutton btw CardboardedCharacter 53 — 7y
0
LoadAsset or LoadAssetVersion from a LocalScript will create a error. You can opt-out of this feature by setting InsertService.AllowClientInsertModels to true cabbler 1942 — 7y
0
and how do i do that? CardboardedCharacter 53 — 7y

1 answer

Log in to vote
0
Answered by 4 years ago

LoadAsset cannot be called from LocalScript that’s why, try to change the LocalScript into Script OR use a RemoteEvent instead

Ad

Answer this question