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

How to make InsertService work server-side?

When I run this local script through a GUI in Studio Test,

local player = script.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
	local debounce = false
	if debounce == false then
		debounce = true
		script.Parent.Parent.DeactivateButton.Style = 5
		script.Parent.Parent.DeactivateButton.Visible = true
		script.Parent.Style = 4
		wait(0.05)
		script.Parent.Style = 5
		local assetId = script.Parent.Parent.IdBox.Text
--This part is the part I'm having trouble with
        if assetId then
            local model = game:GetService("InsertService"):LoadAsset(assetId)
            for _, child in pairs(model:GetChildren()) do
                player:LoadCharacterAppearance(child)
            end
        end
---------------------------------------
		script.Parent.Parent.Status.Text = "Status: Loading"
		wait(1)
		script.Parent.Parent.Status.Text = "Status: Successful"
		wait(1)
		debounce = false
		script.Parent.Parent.Status.Text = "Status: Waiting"
	end
end)

it adds hats to the test player as intended. However, if I run this script in Server Test, it throws this error:

exception while signalling: InsertService.AllowClientInsertModels set to False, insert failed for Asset 255827175. See http://devforum.roblox.com/t/coming-changes-to-insert-service/30327 for more information.

What parts do I have to add or remove to make it work server-side?

3 comments

1

From the roblox wiki: In order to successfully insert a model, it must be owned either by the place creator or by the user ROBLOX. When inserting a model on the client (via a Local Script), the model must also have been created by the place creator or by ROBLOX. If your game needs to insert an asset in a Local Script, use a RemoteEvent or RemoteFunction like in this Example. The model must be trus

0

Correct me if I'm wrong but I'm pretty sure this issue is what broke the insert tool...

1

Your error is InsertService.AllowClientInsertModels is set to false. Wich means a CLIENT should'nt be able to insert anything, I have no idea why that error would be thrown on the server.

1 answer

Please make sure that your Insert Service in the explorer is set to On so the script can "borrow" from Insert Service. Also, the script

InsertService.AllowClientInsertModels

Is set to false, that is just like setting it to

Nil

Please make sure to set it to true

1 comment

0

To clarify for anyone looking at this recently, you technically shouldn't be doing this because allowing clients to insert assets is a huge security hole for your game.

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