Skip to main content
When a vehicle is deleted by an admin command or stored in a garage, you may need to remove it from persistence so it doesn’t respawn later. Here are a few examples of how to accomplish this using the ForgetVehicle export.

Delete Vehicle Command (/dv)

When you delete a vehicle manually using a command, you should remove it from persistence so it is no longer restored automatically.
Add this line: exports['ts-persistence']:ForgetVehicle(nil, QBCore.Functions.GetPlate(veh))
resources/[qb]/qb-core/client/events.lua

Sync door lock status changes

When your keys script locks/unlocks a vehicle, also update ts-persistence with: exports['ts-persistence']:UpdateDoorStatus(vehicle, status)
  • status = 2 to lock
  • status = 1 to unlock
Example with lfKeys (same integration pattern for any keys script):
Important: the lfKeys snippet is only a reference.
For any other keys script, call UpdateDoorStatus right after the lock status changes.

Adding to a Garage System

If you are adding this script to your server, you will need to call the export when a vehicle is successfully stored in the garage so that it is no longer restored from persistence. Here is an example of how it looks in the default qb-garages script when a vehicle is deposited:
Add this line: exports['ts-persistence']:ForgetVehicle(nil, plate)
resources/[qb]/qb-garages/client/main.lua
Last modified on April 1, 2026