FiveM Scaleform
Scaleform is GTA V’s built-in Flash-based overlay renderer. It draws the game’s native HUD elements — mission text, big feed messages, leaderboard panels, instructional button prompts — and FiveM resources can request and drive those same movies from script.
Scaleform reuses assets already shipped with the game and renders through the native pipeline, so it has near-zero overhead compared to a browser frame. It cannot load arbitrary web content or run your own HTML/CSS/JS: for a custom interface, use NUI instead. Reach for Scaleform when you want a GTA-native look (mission text, big feed banners, leaderboards) with minimal cost, and NUI when you need a fully custom UI.
Scaleform vs NUI
| Scaleform | NUI | |
|---|---|---|
| Renderer | Game’s native Flash-based overlay system | Chromium browser frame |
| Content | Built-in GTA movies only | Your own HTML/CSS/JS |
| Look | Matches native GTA HUD | Fully custom |
| Cost | Very low | Higher, and scales with the page |
| Input | Not interactive on its own | Full DOM input via NUI focus |
The Scaleform lifecycle
Every Scaleform movie follows the same four steps: request, wait for load, push function calls to configure it, draw it every frame while it should be visible, then release it when done.
Request and wait for load
local scaleform = RequestScaleformMovie('MIDSIZE_SHARD')
local timeout = GetGameTimer() + 5000
while not HasScaleformMovieLoaded(scaleform) do
if GetGameTimer() > timeout then
scaleform = nil
break
end
Wait(0)
endRequestScaleformMovie returns a handle immediately, but the movie streams
in asynchronously. Always poll HasScaleformMovieLoaded before pushing
function calls or drawing — an unloaded handle silently does nothing.
Push functions and parameters
Scaleform movies expose an ActionScript function table. Call a function by name, push its parameters in order, then pop to execute:
local function showMidsizeShard(title, subtitle)
if not scaleform or not HasScaleformMovieLoaded(scaleform) then
return
end
PushScaleformMovieFunction(scaleform, 'SHOW_SHARD_WRAPPER_TITLE_MESSAGE')
PushScaleformMovieFunctionParameterString(title)
PushScaleformMovieFunctionParameterString(subtitle)
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, 'SHOW_SHARD_WRAPPER')
PopScaleformMovieFunctionVoid()
endParameter push order must match the movie’s expected argument order. Use
PushScaleformMovieFunctionParameterInt, ...ParameterFloat,
...ParameterString, or ...ParameterBool depending on the argument type the
movie expects.
Draw every frame
A Scaleform movie only renders while you draw it. Drive it from a render thread while it should be visible:
local shardActive = false
CreateThread(function()
while true do
local waitTime = 5
if shardActive and scaleform then
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
waitTime = 0
end
Wait(waitTime)
end
end)Use DrawScaleformMovieFullscreen(scaleform, r, g, b, alpha, unk) for
full-screen overlays like mission text or big feed messages. Use
DrawScaleformMovie(scaleform, x, y, width, height, r, g, b, alpha, unk) to
position and size a movie within a normalized 0.0–1.0 screen area, useful
for HUD elements that live in a corner rather than covering the screen.
Raise the loop’s wait interval back up when nothing needs drawing that frame
— polling DrawScaleformMovieFullscreen at Wait(0) unconditionally wastes
frame time.
Clean up
Release the movie once you no longer need it, and drop your reference to the handle:
local function hideMidsizeShard()
if not scaleform then
return
end
SetScaleformMovieAsNoLongerNeeded(scaleform)
scaleform = nil
shardActive = false
end
AddEventHandler('onResourceStop', function(resourceName)
if resourceName ~= GetCurrentResourceName() then
return
end
hideMidsizeShard()
end)An un-released Scaleform handle keeps the movie streamed in memory. Release it on close and on resource stop.
Common built-in movies
These GTA-shipped movie names are commonly reused from script:
MIDSIZE_SHARD— title/subtitle banner, used for mission-pass-style textINSTRUCTIONAL_BUTTONS— the button-prompt legend shown in the corner of the screenMP_BIG_MESSAGE_FREEMODE— the large centered “mission passed” / big feed-style message
Function names and expected parameters differ per movie. Confirm the exact function signature for a given movie in the official native reference before relying on it, since undocumented movies vary by GTA build.
Common problems
Nothing draws
- Confirm
HasScaleformMovieLoadedreturnstruebefore drawing. - Confirm the draw call runs every frame the movie should be visible — a Scaleform movie renders only on the frame it’s drawn.
- Check the movie name is spelled and cased exactly as the game expects.
The movie loads but the content is wrong
- Confirm parameters are pushed in the order the movie’s function expects.
- Confirm the parameter push function (
Int/Float/String/Bool) matches the argument type. - Call
PopScaleformMovieFunctionVoidonce per pushed function, immediately after its parameters.
Memory or streaming warnings
- Call
SetScaleformMovieAsNoLongerNeededwhen the UI closes, not only on resource stop. - Do not call
RequestScaleformMovierepeatedly in a loop — request once, reuse the handle, and release it when finished.