ESXserver
xPlayer.removeMoney
ESX server documentation with a FiveM Lua example.
Summary
Removes money from a player's main account in ESX. Check the player can afford it first.
Returns
void
Parameters
amountnumberThe amount to remove.Example
local xPlayer = ESX.GetPlayerFromId(src)
if xPlayer.getMoney() >= 100 then
xPlayer.removeMoney(100)
-- give the item
endCommon pitfalls
- removeMoney doesn't stop at zero on all versions — check getMoney() before removing.
- Do the check and the reward together, server-side.
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 →