I am scripting an admin commands thing, and one of the commands is supposed to give a player gear, but InsertService won’t load any of the gear.
I’ve tried looking for solutions on the DevForum and YouTube, but they seem to only be for inserting an asset into workspace not into a specific player’s backpack.
An error code I got was “Unable to cast string to int64”
local gearcmd = "!gear"
local asset = game:GetService("InsertService")
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg:sub(1,gearcmd:len()):lower() == gearcmd:lower() and player.UserId == admin1 then
local id = msg:sub(gearcmd:len()+1)
local event = Instance.new("RemoteEvent")
event:FireServer()
event.OnServerEvent:Connect(function(plr)
print("successful lol")
wait(1)
local gear = asset:LoadAsset(id)
wait(1)
gear.Parent = game.ServerStorage
wait(1)
gear:Clone().Parent = plr.Backpack
end)
end
end)
end)