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 :)

3 comments
This is a localscript in a textbutton btw
LoadAsset or LoadAssetVersion from a LocalScript will create a error. You can opt-out of this feature by setting InsertService.AllowClientInsertModels to true
and how do i do that?