Use this to send data to the NUI (NewUI)
SendNUIMessage(table data)
LUA
SendNUIMessage({
hello = "world",
action = "showMessage"
})
JS (NUI PART)
window.addEventListener('message', (event) => {
let data = event.data
if(data.action == 'showMessage') {
console.log(`Hello ${data.hello}!`) // will print Hello world! in the console (F8)
}
})