Hi! I need some help.
So, I am making a GUI where you type the Asset ID into the TextBox, then click ‘SPAWN’, and the Model will Load In.
However, I am getting the Error:
19:29:31.932 Unable to cast Instance to int64 - Server - Script:5
Is this because I am doing two scripts?
Script 1, changing a NumberValue
to the inserted ID:
local value = script.Parent
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
value.Value = script.Parent.Parent.IDinsert.Text
end)
Script 2, Inserting the Model:
InsertSevice = game:GetService("InsertService")
local ID = script.Parent.ID
script.Parent.TextButton.MouseButton1Click:Connect(function()
wait(1)
local Model = InsertSevice:LoadAsset(ID)
Model.Parent = workspace
end)
The Constant called ID
is the Number Value.
Thanks, AridOats.