So probably you made a mistake with the copy-paste (we all do sometimes )
Here’s why.
If I look at your client\main.lua, I see you registered the event, and made a Handler for ‘esx_burn:MsgPlaya’ so that you can trigger that from server side. That’s fine.
Then on the server\main.lua, you registered the server event ‘esx_burn:tellALLPlayers’ but the handler below that is ‘esx_burn:MsgPlaya’ when I believe that should be ‘esx_burn:tellALLPlayers’. This is an issue.
On your client side, on the bottom I see you have a Citizen.CreateThread with a function, commented as it doesn’t work. I believe there are 2 main issues there (without running the script).
- The TriggerClientEvent you commented out is wrong. If you want to trigger a client event from client side, use TriggerEvent(“eventName”, args), if you want to trigger a server event, then TriggerServerEvent(“eventName”, args), and the “eventName” should be the name of the event you registered with RegisterServerEvent().
- By looking at the code, you want to run MsgPlayer, and all that 1 time per button press, and not spamming after every frame while the button is pressed, so replace IsControlPressed with IsControlJustPressed.
- Also one minor thing, that I’m like only 90% sure - because I’m also new to this, still learning - is that you should put the Citizen.Wait(1) to the end of the while loop, because you want the code to run first, then wait a frame, and AFAIK Citizen.Wait(0) yields the same result. This is where I read that: Citizen.Wait(X)