local is = game:GetService("InsertService") local button = script.Parent local text = button.Text is:LoadAsset(text).Parent = workspace
the error is 'Unable to cast string to int64'
LoadAsset requires an integer as input:
local is = game:GetService("InsertService") local button = script.Parent local text = tonumber(button.Text) is:LoadAsset(text).Parent = workspace
You may want or not want to see this but if you still want to do this,remember that the player cant communicate with the server without a Remote Event! Also remember that the service only instances a model owned by the game creator or ROBLOX
Insert a script in ServerScriptService,and a remote event called "InsertModel" on ReplicatedStorage
game.ReplicatedStorage.InsertModel.OnServerEvent:Connect(function(player,ID) local InsService = game:GetService("InsertService") local TheID = ID InsService:LoadAsset(TheID).Parent = workspace end)
In StarterGui,Insert A ScreenGui called "InsertGui." There,Insert 2 things more,A textButton called "Button", and a TextBox called "IdType." Insert a LocalScript on the Button:
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.InsertModel:FireServer(script.Parent.Parent.IdType.Text) end)
I tried it and it works,even without the tonumber(),but if it doesnt work you can add it to the server script tonumber(ID)
Hope it helps! Never give up to reach your beloved dreams!