InsertService:LoadAsset() returning error that makes no sense

Part of a modulescript, so sometimes runs locally.

	local function GetAdornee()
		repeat
			local success , err = pcall(function()
				local asset
				if game:GetService("RunService"):IsClient() == true then
					asset = game.ReplicatedStorage.GetCreatureModel:InvokeServer(AdorneeId)
				else
					asset = game:GetService("InsertService"):LoadAsset(AdorneeId):FindFirstChildWhichIsA("Model")			
				end 
				assert(asset)
				return asset
			end)
			if err then warn(err) end
			wait(0.5)
		until success
	end

remote function:

game.ReplicatedStorage.GetCreatureModel.OnServerInvoke = function (Player , AdorneeId)
	local asset = game:GetService("InsertService"):LoadAsset(AdorneeId):FindFirstChildWhichIsA("Model")
	asset.Parent = Player.PlayerGui.BattleScreen.Frame.ViewportFrame.WorldModel
	wait()
	return asset
end

The error returned is the model’s name for some reason

err is just the return value of the function wrapped in a pcall. You should use the success variable to figure out if it errored.

1 Like