client
SetPedAsNoLongerNeeded / SetEntityAsNoLongerNeeded
FiveM client native documentation with a Lua example.
Summary
Tells the engine it can clean up an entity you no longer control, preventing leaks of spawned peds/vehicles/objects.
Returns
void
Parameters
entitynumberThe entity handle (by reference).Example
local ped = CreatePed(...)
-- use it
SetPedAsNoLongerNeeded(ped)Common pitfalls
- Call after you're done with a spawned entity you don't need to manage.
- Not the same as deleting — it lets the engine clean up naturally.
Related natives
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 →