ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
client

SendNUIMessage

FiveM client native documentation with a Lua example.

Summary

Sends data from Lua to your NUI (HTML/JS) as a JSON message. The main way Lua tells the UI what to show.

Returns

void

Parameters

datatableThe message payload (becomes JSON).

Example

SendNUIMessage({ action = 'open', items = myItems })

-- JS side:
-- window.addEventListener('message', (e) => { if (e.data.action === 'open') {...} })

Common pitfalls

  • The JS side must listen for the message and match on a field (e.g. action).
  • Keep payloads reasonably small; huge messages every frame hurt performance.

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 →