I’m generating a bunch of objects on the server and want to make them interactable using ox_target, for that I need to transfer them to the client. The problem is that when I try to transfer them using NetID I get the following error:
server.lua (lines 107-110):
table.insert(objs, CreateObject(prop, xcord, ycord, 9.24316, false, false, false))
local rotation = math.random(0, 360)+0.0
SetEntityHeading(objs[ind], rotation)
TriggerClientEvent("testtest", 1, NetworkGetNetworkIdFromEntity(objs[ind]))
client.lua:
RegisterNetEvent('testtest')
AddEventHandler('testtest', function(netId)
local ent = NetworkGetEntityFromNetworkId(netId)
exports.ox_target:addEntity(ent, {
{
icon = "fa-solid fa-box",
label = "test",
distance = 2.0,
onSelect = function(data)
print("test")
end,
canInteract = function(entity)
return true
end
}
})
end)