Any way to send information from the server to the client without events?

Uh is there anyway just curious if you guys may know if there is a way?

5 Likes

The server is constantly sending information to the client - everything that happens on the server is automatically replicated. How do you want to send information?

2 Likes

All I can really think of is using ModuleScripts.

Yes Im aware of that but im talking about custom stuff like table or yknow string or number or EVEN booleans OR MAYBE even yeah thats all

Module scripts arent replicated unforunately, the server gets a copy and the client gets a copy

1 Like

You could try updating Value objects and using :GetPropertyChangedSignal in a local script. This wouldn’t work for tables though. But if you’re trying to get around using events, I urge you to learn how to use them, they are very useful.

3 Likes

Oh I know how to use them but I want the communication in my game to be seamlesssss ALSO very little latency cause waiting for the server to give me my info im asking for can take noticable amount of time depending on what im doing

Events are as seamless as it gets. Everyone uses events, trust. Don’t be afraid to use them.

1 Like

What would be the advantages of using value objects?
(network performance wise)

It would be roughly the same speed or slower than using events.

But wouldnt it be faster because Id be reading the information from the client and not waiting for the server to give me a response to the information i asked for? :thinking:

You’re still waiting for the server to change that data, before acting on it. Latency exists for all client-server interactions.

If you have a lot of fixed data, that doesn’t change on the server, I recommend using a module script.

1 Like

Hm, interesting I see, have you tested the performance between these or?

Technically it’s not client and server communcation because the client is reading the data already changed by the server, there is no interacting persay

When the server changes the data, it takes a bit for the client to recognize that change, because the server has to replicate that change to the client. So there would be some delay when using :GetPropertyChangedSignal on the client as opposed to on the server.

Yeah but wouldn’t it be even more noticable if you were to use a remote function asking for the same data?

Whatever you do on the server, if its changing a value, moving a part, or firing an event, it will still take a little while for the data to reach the client. No matter what the data is. I would suggest events because its simpler.

Not really, when you use an event it sends the data directly to the client instead of using the value object as an in-between, if that makes sense.

When you use a value object,

  1. The server changes the value of the value object.
  2. The server has to replicate that change to the value object.
  3. The client detects this change, and executes whatever function you want to run.

When using an event,

  1. The server sends the data directly to the client.
  2. The client receives this event and executes whatever function you want to run.

Hm interesting, if that the case then can you explain this

I had a simple play button that when it was clicked it would invoke the server and the remote function would return if the a game was in progress

In studio, there was a bit of noticable delay but not very much before the code on the client would execute if there wasn’t a game in progress

Then I hopped into a real game with about 50-60ms and I was pretty shocked as it took at least almost half a second for the code to run after checking if there was a game in progress

So then on the server I decided to hookup a bool value that would rest in workspace called GameInProgress and when a game was in progress I would instead read that value straight from the client and the latency was pretty much next to nothing

So can you just run me through what exactly was going on there?

So, when you use a remote function, your client sends a request to the server, which then sends a response back to the client. In a way, you have twice the latency.

When you use a bool value, the data is consistently replicated as soon as it changes. This removes the need for the back-and-forward remote function.

2 Likes

So is this statement you made true or false?