Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unable to cast instance to int64?

local InsertService = game:GetService("InsertService")
local Send = game.ReplicatedStorage.Send

Send.OnServerEvent:Connect(function(id)
	local Assetid = id
	local Model = InsertService:LoadAsset(Assetid)
    Model.Parent = game.Workspace
    Model.Name = "InsertedModel:" .. Assetid
    Model:MakeJoints()
    return Model:GetChildren()[1]
end)

5 comments

0

What is the error line?

0

We need more info, Like what script called the Event what are you trying to achieve?

0

My understanding is that LoadAsset requires an AssetId but you gave it an instance. But i don't know what the instance is

0

Unable to cast instance to int64

0

nicholast013

1 answer

✓ Accepted answer

your code is basically right but whenever you get a server event fired the first parameter is always the player no matter what.

local InsertService = game:GetService("InsertService")
local Send = game.ReplicatedStorage.Send

Send.OnServerEvent:Connect(function(player, id)-- player is the first parameter
    local Assetid = id
    local Model = InsertService:LoadAsset(Assetid)
    Model.Parent = game.Workspace
    Model.Name = "InsertedModel:" .. Assetid
    Model:MakeJoints()
    return Model:GetChildren()[1]
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.