:FireAllClients() or :FireServer() for Replicating?

Hi everyone.

Recently I have been using :FireServer() with Remote Events to replicate things across clients. However, doing this too much causes lag in my game. So I look at it like this, if the server is handling too much Remote Events being sent in or it’s doing a lot of work it will cause to lag.

My question is, would using :FireAllClients() decrease the lag since the Server isn’t doing that much work? Or is there a better replication method that doesn’t cause Server lag.

1 Like

I’m not too sure what you mean, but I think you’re asking if you should call :FireAllClients() from one client to all others.

You can only call :FireClient(player) and :FireAllClients() from the server. The server has to be the middle-man between remotes.

1 Like

No, that’s not what I mean. I mean Replication Method, read my post.

I read your post.

followed by

The question appears to be “would using :FireAllClients() be more efficient than :FireServer()”. If that’s not the question then I think you should reword your post as I do not understand what you’re asking. :confused:

If it’s just visual stuff, the server can tell the client to replicate/decide whether they need to replicate it themselves, yeah. If it’s something like health or money, (affects other players/actually matters) that should all be on the server.

5 Likes

So basically if it’s just some sort of Effects or something like maybe a Trail Effect on the player’s feet and I want other people to see that, I would just use FireAllClients to do that instead of the server doing it?

1 Like

Yeah, that’s what I’d do. That way if a client doesn’t need to see it they don’t have to create the trail locally, and there’s less strain on the server.

What about body movers and cframing to move objects?

If you’re tweening something’s CFrame, that can be handled on the client (there’s actually modules to do this for you, so it’s definitely not uncommon) but I’m not sure about body movers since I don’t use them enough myself. If you’re just setting the CFrame of something once, definitely handle it on the server.

Now, using :FireAllClients(), wouldn’t there be some delay / de-synchronization across clients?

There’s already going to be some anyway; you can see that with people floating behind moving platforms in many games. I doubt the difference is huge, but if it’s big enough to matter then you can handle it on the server instead.

Alright man, thanks for your help. If it’s okay, I’ll dm you if I need help on this any further.

1 Like

Sorry, but I’m not exactly a big expert on this, so it’d be better if you post here (or another thread) to have others who can correct me or add on to what I’m saying.

If you’re using RemoteEvents to replicate some state of one client to every client in the game, you’re probably doing something wrong and there’s usually a better way. Explanations, according to your replies so far:

Network ownership is a feature specifically designed to give a certain client control over the physics of a part or collection of parts. You should use this instead of constantly firing the server to then fire all clients with new physics information.

If you’re relying on a client to decide when other clients have an effect appear, you need to rethink your approach to the client-server model. For security and gameplay reasons, the server should be the one that decides when other clients create an effect, not a client.

If you create a trail affect on a player’s feet on the server this should automatically replicate.

Personally, I’ve been moving to reduce server memory usage by not having the server handle small tasks. If it’s something visual, then I can just use FireAllClients or use a custom filter solution in which only nearby clients render effects (FireClient to nearby characters).

I would only use FireServer to handle important tasks that must be on the server. The client can handle a lot and should in terms of rendering, visualising and more.

1 Like

The whole idea of FireAllClients is to display the same request on every single Client. Usually, a person would Fire a event to the Server, once it’s fired, the server would then fire another event with FireAllClients to display some sort of effect.