You need to load the asset from the server side by using a remote event
-- server side
local RepStorage = GetService("ReplicatedStorage")
local Event = RepStorage:WaitForChild("LoadAsset") or Istance.New("RemoteEvent", RepStorage)
Event.Name = "LoadAsset"
Event.OnServerEvent:Connect(function(player, id)
Object = game:GetService("InsertService"):LoadAsset(id)
Object:MoveTo(Vector3.new(0, 0, 0)) --try this
Object.Parent = workspace
end)
-- local side
local Event = game:GetService("ReplicatedStorage"):WaitForChild("LoadAsset")
script.Parent.MouseButton1Click:connect(function()
local text = script.Parent.TextBox.Text
if tonumeber(text) then
Event:FireServer(tonumeber(text))
end
end)
oh, if you have something like that then you can set the button text as the name of the vehicle and then put a dictionary in the script, like that:
local vehicles = {
["Vehicle name 1"] = ID; --set the names and the ids
["Vehicle name 2"] = ID;
["Vehicle name 3"] = ID;
}
-- the button:
script.Parent.MouseButton1Click:connect(function()
Event:FireServer(vehicles[script.Parent.Text])
end)
It shouldn’t cause any lag, in fact the response times are much shorter if you do as she says, becouse the game dont need to load the asset but just copy it from the server storage and paste it to the workspace