Onspawn event causes error for nui jason help?

Hi I have been trying to create a menu popup on spawn but for some odd reason I keep getting tis error:

I know its the spawn event because I took it a way and it doesn’t show the error however I need to spawn even for the script I’m making

What kinda of data are you sending? Seems like rapidjson doesn’t like you sending that piece of data.

Before you call SendNuiMessage(data), try to log it.

I logged it that is all fine but it just says that error for some strange reason is there any scripts that uses ui on spawn I can look at for reference

I logged it that is all fine

Please share this piece of data, clearly it’s not fine as rapidjson seems to have issue with it.

AddEventHandler("playerSpawned", function(spawn)
	TriggerEvent("openHud")
end)
RegisterNetEvent("openHud")
AddEventHandler("openHud", function ()
	Citizen.Trace("IS THIS WORKING!?")
	SetNuiFocus(false, false)
	SendNuiMessage({openCad = true})
end)

CLIENT.LUA^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Try sending it as an string

SendNuiMessage({openCad = "true"})

ok 1 sec then

[20 char]

Nope same error?

[20 char]

Ok found the issue, you need to call SendNUIMessage instead of SendNuiMessage. Apparently some wrapper exists for it in LUA that will encode everything to JSON :stuck_out_tongue:

oh ok lol thanks a lot man :slight_smile:

NVM I have fixed it lol