Yes it wouldn’t work, but you would see the
event <eventname> was not safe for net message, that is if you are triggering a server event from the client or a client event from the server.
If you are triggering a server event from a server script (or client event from a client script) you don’t need to register the event (you can, but it works fine if you do it without registering).
server_script_two.lua (note this is delayed to make sure the other script is loaded before executing the event)
Server console output:
However if you try to trigger the ‘test’ event from a client script, like so:
You get this error in the client console.
event test was not safe for net
This is because the event isn’t registered to be used cross client/server.
To fix this, simply add
RegisterServerEvent("test") to your server script like so:
now the output will be this in your server console
(remember, it prints “success” twice because the server_script_two.lua triggers it once, then the client also triggers it.)
The example above just covers the server to server and client to server scenario, but it is the same for client to client and server to client scenarios.
This is also the same if you want to do it cross resource. example:
Output in server console: