[Solved] NUI JS event never called?

Hey there,

I have issues setting up a simple GUI with NUI, here’s my JS code :

window.addEventListener('message', function(event) {
	if (event.data.updateHUD == true) {

Yes, I also checked if my HTML has the right id.
And here’s my lua script :

SendNUIMessage({ updateBalance = true, Balance = values.Balance["balance"] })

I’ve checked if the script is called by adding console debugging after this line, it’s called. No error.
I’ve checked if values.Balance["balance"] is not nil, it isn’t.

Any idea ?


Replace event.data.updateHUD per event.data.updateBalance
or create elseif

if (event.data.updateHUD == true) {
    // in jQuery = $('MeHUD').css('display', 'block');
elseif (event.data.updateBalance == true) {
// or $('#Balance').html(event.data.Balance);

Tuto for HTML ui and lua


Indeed, obvious mistake ahah. Cheers mate !

1 Like