Hi! I’m trying to help a friend out and I am stuck. So in my server, I have an event that takes the callback from my client and calls it, this is good for triggering functions that you can’t trigger on a specific side, however, all I get is “object is not a string”
client.lua
local QBCore = exports['qb-core']:GetCoreObject()
for i = 1, #Config.Objects do
local model = Config.Objects[i]
exports['qb-target']:AddTargetModel(model, { -- This defines the models, can be a string or a table
options = { -- This is your options table, in this table all the options will be specified for the target to accept
{ -- This is the first table with options, you can make as many options inside the options table as you want
num = 1, -- This is the position number of your option in the list of options in the qb-target context menu (OPTIONAL)
type = "client", -- This specifies the type of event the target has to trigger on click, this can be "client", "server", "command" or "qbcommand", this is OPTIONAL and will only work if the event is also specified
event = "Test:Event", -- This is the event it will trigger on click, this can be a client event, server event, command or qbcore registered command, NOTICE: Normal command can't have arguments passed through, QBCore registered ones can have arguments passed through
icon = 'fas fa-example', -- This is the icon that will display next to this trigger option
label = 'Test', -- This is the label of this option which you would be able to click on to trigger everything, this has to be a string
action = function(entity) -- This is the action it has to perform, this REPLACES the event and this is OPTIONAL
TriggerServerEvent("myDustbin:GetServerCallback", Test)
end,
canInteract = function(entity, distance, data) -- This will check if you can interact with it, this won't show up if it returns false, this is OPTIONAL
if IsPedAPlayer(entity) then return false end -- This will return false if the entity interacted with is a player and otherwise returns true
return true
end,
}
},
distance = 2.5, -- This is the distance for you to be at for the target to turn blue, this is in GTA units and has to be a float value
})
end
function Test(playerItems)
print("e")
end
server.lua
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent("myDustbin:GetServerCallback")
AddEventHandler("myDustbin:GetServerCallback", function (cb)
cb("ok")
end)




