QBCoreclient
QBCore.Functions.SpawnVehicle
QBCore client documentation with a FiveM Lua example.
Summary
Spawns a vehicle client-side in QBCore, handling model loading and networking for you, then returns the vehicle via callback. A convenience wrapper around the raw vehicle natives.
Returns
void (vehicle handle via callback).
Parameters
modelstringThe vehicle model name.cbfunctionCallback receiving the spawned vehicle handle.coordsvector4Optional spawn coords (defaults to player).isNetworkedbooleanWhether the vehicle is networked.Example
QBCore.Functions.SpawnVehicle('adder', function(veh)
SetVehicleNumberPlateText(veh, 'TEST')
TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
end, coords, true)Common pitfalls
- The model must be valid (IsModelInCdimage) or it returns early.
- It handles RequestModel/HasModelLoaded internally, so you don't have to.
- For server-authoritative spawning on serious servers, prefer a server-side flow.
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 →