local ID = script.Parent.Parent.IdHolder local InsertService = game:GetService("InsertService") local Model = InsertService:LoadAsset(ID) local NewModel = Model:GetChildren()[1] NewModel.Parent = workspace Model:Destroy() script.Parent.Parent.Display.Text = "Sucsess"
Its in a script in a gui how to fix this script my output error is
Unable to cast Instance to int64
Hello, hokyboy!
You just need to transform a string into a number with tonumber()
local ID = script.Parent.Parent.IdHolder.Text -- Getss the text local InsertService = game:GetService("InsertService") local Model = InsertService:LoadAsset(tonumber(ID)) -- Transforms text into a number local NewModel = Model:GetChildren()[1] NewModel.Parent = workspace Model:Destroy() script.Parent.Parent.Display.Text = "Sucsess"