Hi, I am trying to trigger a callback to the client to display some data but when I trigger the callback the my sql query return nil.
here is the errors u can see the data is nil by my prints in the script
SQL

The script should return a Callback of 0 to the client script as 0 is in the sql but it doesnt its nil even with a number there its still nil
Here is the code:
server
QBCore.Functions.CreateCallback('atmrob:timeout', function(source, cb)
local _source = source
local xPlayer = QBCore.Functions.GetPlayer(_source)
local id = xPlayer.PlayerData.citizenid
print(id)
--cb(getPet(xPlayer.identifier))
local result = MySQL.query.await('SELECT atmtimeout FROM players WHERE citizenid = ?', { id })
if result[1] then
print(result[1].atmtimeout)
cb(result[1].atmtimeout)
else
cb(0)
end
end)
CLient
QBCore.Functions.TriggerCallback("atmrob:timeout", function(data)
Timeout = data
print(data)
if Timeout == nil then
TriggerServerEvent("atmrob:update", 0)
Timeout = 0
print("it was nil ffs")
end
--print(Timeout)
RegisterCommand("atmtimeout", function()
exports['okokNotify']:Alert("ATM Robbery", "You have "..tostring(math.floor(Timeout/60000)).." Mins before you can rob an ATM", 7000, 'info')
end,false)
while Timeout > 0 do
local xPlayer = QBCore.Functions.GetPlayerData()
Timeout = Timeout - Config.SqlUpdateTime
--print(Timeout)
TriggerServerEvent("atmrob:update", Timeout)
Wait(Config.SqlUpdateTime * 1000)
if Timeout == 0 then
Robbing = false
TriggerServerEvent("atmrob:update", Timeout)
end
end
end)
