i have a problem with my coding and i’m getting stuck on it
function openCrate()
exports['skillchecks']:startUntangleGame(50000, 5, function(success)
if success then
exports['qb-target']:RemoveTargetEntity(weaponBox)
-- Generate loot based on the current difficulty level
local loot = generateLoot(currentDifficulty)
-- Add the loot to the player's inventory
for _, item in pairs(loot) do
if QBCore.Shared.Items[item.item] then
-- Trigger the client event to show the item box
TriggerClientEvent('qb-inventory:client:ItemBox', item.item, QBCore.Shared.Items[item.item], 'add')
-- Add a delay before adding the item to the inventory
Citizen.Wait(3000) -- Wait for 3 seconds (3000 milliseconds)
-- Now add the item to the player's inventory
TriggerServerEvent('jomidar:bargheist:addItem', item.item, item.amount)
else
-- Log an error if the item does not exist
print("Item does not exist: " .. tostring(item.item))
end
end
else
Jomidar.Functions.Notify("You Failed, Try again!", "error")
end
end)
end
've encountered a problem with my coding and I’m stuck. When I try to use TriggerClientEvent('qb-inventory:client:ItemBox', item.item, QBCore.Shared.Items[item.item], 'add')
, I keep getting a nil value. I can’t figure out why this is happening and have been struggling with it for about 3 hours. Can you help me debug this issue?
what i know so far is
i get the correct response from item.item from the statement above but if i use it there it sends back a nill value i checked if the item existed inside of the shared items folder and it did came back with a table and name