CreateThread, Wait, and the tick budget
Every FiveM script runs inside one Lua VM per resource. The VM has a strict per-tick budget. CreateThread spawns a coroutine; Wait(ms) yields it back to the engine. Forget the Wait and you freeze the game. Use the wrong Wait value and your script either hogs the frame or feels laggy. This bonus is the deep dive that turns "I copied the boilerplate" into "I know exactly why it's there."
Build it
Make the resource folder
Inside your server's resources folder, create this folder:
resources/qu_createthread_and_wait
Create the files
Create this exact file layout:
resources/qu_createthread_and_wait/
fxmanifest.lua
client.lua