如何将 InsertService:LoadAsset() 与模型名称一起使用,而不是资产 ID?

how to use InsertService:LoadAsset() with the name of model, not asset id?

我正在与 Roblox 工作室合作 InsertService:LoadAsset() API 可以导入模型、贴花、脚本等...我正在尝试做同样的事情(导入模型和贴花)只是模型的名称,而不是 id。

代码形式@darkelementallord (roblox):

local ID = 0000000 --Change this to the model ID
local InsertService = game:GetService("InsertService") --Get the service

local Model = InsertService:LoadAsset(ID) --Insert the model
local NewModel = Model:GetChildren()[1] --Find your model

NewModel.Parent = workspace --Put it into the game
Model:Destroy() --Destroy the container model

您不能仅使用 Asset 的名称加载带有 InsertServiceAsset。 您需要 AssetAssetId 来加载它。