client
RequestModel
FiveM client native documentation with a Lua example.
Summary
Requests a model to be loaded into memory before you can spawn or use it. Pair with HasModelLoaded in a wait loop.
Returns
void
Parameters
modelHashThe model hash to load.Example
local model = `adder`
RequestModel(model)
while not HasModelLoaded(model) do
Wait(0)
end
-- now safe to use the model
SetModelAsNoLongerNeeded(model)Common pitfalls
- Always wait for HasModelLoaded before using the model, or the spawn fails silently.
- Call SetModelAsNoLongerNeeded after use to free memory.
- Add a timeout to the wait loop so a bad model doesn't hang forever.
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 →