ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
QBCoreserver

Player.Functions.AddItem

QBCore server documentation with a FiveM Lua example.

Summary

Adds an item to a player's inventory in QBCore's native inventory. (On ox_inventory servers, use the ox_inventory exports instead.)

Returns

boolean — whether it succeeded.

Parameters

itemstringThe item name (must exist in shared items).
amountnumberHow many to add.
slotnumberOptional slot.
infotableOptional metadata.

Example

local Player = QBCore.Functions.GetPlayer(src)
if Player.Functions.AddItem('water', 1) then
  TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['water'], 'add')
end

Common pitfalls

  • The item must be defined in QBCore shared items or it fails.
  • On servers using ox_inventory, use exports.ox_inventory:AddItem instead — mixing systems causes bugs.

Related functions

Related guides

FiveM scripts done right

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.

Browse Scripts →