[Solved] "print()" doesn't work?

Hey there,

Here’s my code :

RegisterServerEvent(‘playerSpawn’)
AddEventHandler(‘playerSpawn’, function()
print(“Test !”)
end)

This snippet is loaded, as a server script but nothing prints out in the console. Citizen.Trace do print but only in client scripts, which is expected.

Any idea ?

Thanks

you have it on server or client?

It’s loaded as a server script

try

AddEventHandler(‘playerSpawned’, function(spawn)

Nope, still nothing in the console

Give me a minute ill be right back.

1 Like

Are you calling/triggering this event?

If not, the try triggering the event for “playerSpawn” from the client.

The event is called in the spawnmanager, by default on every FiveM server. And it’s not the issue, the issue is print(), it doesn’t do anything, there’s nothing in the console when using it. I also tried to put in a script that I know is actually called, still prints nothing so yeah, the handler is probably fine, print() isn’t

Its the Event I just did a chat message that print(“Hello World”) and print works… Maybe it just doesn’t work that way. idk.

Can you give me the code you tried please ?

Pretty sure the event called via spawn manager is “playerSpawned” not “playerSpawn”.

In fact, I’m so certain of it, I’ll give you a line number and file name. “spawnmanager.lua” line 284.

So, do what I said and you’ll have it working.

Yeah I also checked to be sure, and indeed, it’s playerSpawned, typo there my bad. Still nothing happenning tho

Again, are you calling the event?

The event that is triggered by the spawn manager is client-side only so, you need to trigger the server-side event.

Oh, well no I’m not. Can you hint me on how to do that please ?

1 Like

https://wiki.fivem.net/wiki/TriggerServerEvent

1 Like

I love you so much <3 I’ve been torturing my head around this for hours !