How to handle remote events

Hello, i have one question which is the best practice for remote events?

I know games like combat games have alot of moves which require client - server communication so which is best practice or is there another way?

  • one remote event for each move needing one
  • one remote event for each moveset

ether way it will total up to alot and i want to know if there is a better way to do this. Thanks

It doesn’t matter, differences are negligible.

1 Like

What are the disadvantages of both?

Realistically, you’ll only need 1 for telling the server to use a skill, and 1 for client sided VFX (I urge you to use client-sided VFX if you aren’t already doing so). As @batteryday said, there isn’t too much of a performance impact.

However, you can benefit from having 3 separate VFX remotes that all have the same function but are randomly fired to distribute the load across 3 separate remote events. You’ll want to focus on Remote Events that are being fired to certain clients or the whole server (like the VFX remote, NOT client → server)

What’s WAY more important than how many Remote Events you have, is the data that you’re sending over. The more arguments, tables, keys, values, or whatever you have, the more stress it will put on the server.

So rather than focusing on the amount of Remote Events, focus on only sending the data that you NEED (via server to client). Here is a simple example that applies to many other different situations:

--BAD
RemoteEvent:FireAllClients({
	Color1 = Character.UpperTorso.Color,
	Name = Character.Name,
	Size = Character.HumanoidRootPart.Size,
})

--GOOD
RemoteEvent:FireAllClients({
	Character = Character, -- Provides all of the information the client needs
})

So to answer your question, “one remote event for each moveset” is the better choice. However, you could go further than that and use 1 remote event for ALL movesets. Honestly, it’s your preference. Focus more on server → client.

Im a little confused about what a VFX remote is. Is it because VFX can overload the server?

1 Like

I don’t see why you’d need to do this? If you mean like you think that animations such as moves would not replicate to the server that’s not true. If you play an animation from the client it’ll replicate to the server and other clients. So don’t worry about that.

I think I get what you’re trying to say here however.

Since the client reacts faster what I tend to do is when the player does the event such as activate the tool. I get all the players in the game using game.Players:GetPlayers(),

then I check if the distance between the client that is running the local script and the other players is less than 2 studs. Then if it is, do your moves and whatever. I think you’d need a remote event for that yeah. You’d probably want to fire to the server and fire to all clients so that its all smooth.

1 Like

By a VFX remote, I mean Remote Events that are used to tell the client a skill should be created. For example, if you wanted a wind tornado skill, computing all of the hitboxes and cooldowns on the server then using a remote event to tell the CLIENT to create the actual EFFECTS will put a LOT less stress on the server.

VFXRemote:FireAllClients("WindTornado", {
--any data you need here
})
1 Like

Ohh so your saying the actual hitboxes and values should be on the server and the visuals on the client. I get what you mean now

1 Like

Yep. Once you start getting more familiar with skills, client-sided VFX is a must. All of the top games do it as it leads to smoother and more efficient skills.

2 Likes

Thanks alot, you helped me understand this topic and gave me some good suggestions. Good day

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.