Call serverside functions from client and viceversa

I’ve been handling client & server connection using events so far. Although I see it’s not the proper way. So, the thing is:
I’ve seen some scripts such as vRP, that apparently call clientside functions from server (or so I think), which would be exactly what I’m looking for, because it’s really unconfortable to use events as functions, when as their name says, they’re not functions, but events…

With that being said, I would like to ask for help. If anyone knows how to do it and/or could show me a simple example, I would infinitely appreciate it.

Thanks in advance! :wink:

The only way I know that you can communicate between the server and client is through events.

AFAIK, vRP uses events as well. They just wrap them in functions that can be ran on the server.

Oh ok, anyway I think that’s what I’m looking for.

Would you please tell me how to do that? Thanks

Use events?

You said

So, I thought you know how to use them…

For triggering client events on the server see: https://wiki.fivem.net/wiki/TriggerClientEvent
For triggering server events on the client see: https://wiki.fivem.net/wiki/TriggerServerEvent

Ofc I know how that works… But you said vRP wraps them in functions, so I would like to learn to do that.