We’re implementing a behaviour change to InsertService in its error case.
Specifically, to properly check for InsertService:LoadAsset failure, it should be wrapped in a pcall similar to other services.
local model
local success, err = pcall(function()
model = game:GetService("InsertService"):LoadAsset(257489726)
end)
if success then
model.Parent = workspace
print("successfully inserted model")
else
warn("unable to insert model because " .. err)
end
The “err” string will contain a brief description of why the request failed.
The previous fail behaviour was to create an empty model.
If your code previously checked for an empty model, this may be a breaking change.
We’ll be rolling out this API change in the coming weeks based on developer feedback.
This is nitpicky, but would you please use conventional variable names in your example code? It took me a bit to realize that fnrtv stood for function return value.
local model
local success, err = pcall(function()
model = game:GetService("InsertService"):LoadAsset(257489726)
end)
if success then
model.Parent = workspace
print("successfully inserted model")
else
warn("unable to insert model because " .. err)
end
This is part of a general cleanup of InsertService internals. There may be other outward-facing changes in the near future.
This specific change was done for consistency, since all similar “services” behave the same way.
In addition, for a localscript “LoadAsset”, there wasn’t any way to know if it succeeded for failed (no error message in the console, had to check for empty model).