Does it matter how many remote events are in a game? Will it lag the server or something? My game has a lot, should I try to cram them down?
Excellent question though! The difference between having one remote or many to handle your client/server interactions is negligible. It all depends on what is deemed more organized to you, or what compliments the work environment of your game the most.
Some people opt for using one RemoteEvent/RemoteFunction to handle communication with the server and client, while passing a conditional argument to tell the remote what to do once it has received information. Here's a little example of how one might implement that method which you can examine here. In that example, the request
variable is used as the condition under which the function for the remote chooses what to do with the given information (...
). Likewise, you could create a separate remote for each of those conditions if you so choose (i.e, a remote event for ChatUpdate
, SavePlayerData
, etc for each condition showed in the example).
As a side note, sweetkid01 made a good point referencing the bandwidth excerpt from the ROBLOX wiki. You do want to be careful regarding how many data packets you're sending to the game server, however, this has little to do with "how many" remotes you have and more to do with "how frequently" you're using them. So in conclusion, it doesn't matter.
From wiki.roblox.com:
Bandwidth
For most devices and connections, a Roblox server can only send and receive about 50 KB/sec of data to each client, not including physics updates. That said, it is highly recommended to maintain a lower value during normal gameplay as sudden spikes in data transfer can cause lag and an overall subpar user experience.
Every time a remote event is fired or a remote function invoked, a packet of data is sent over the network between the server and client. This packet is counted towards the 50 KB/sec limit. If too many packets are sent (remote event or function used often), or too much data is sent per packet (lots of large arguments to the event or function), the latency of the connected clients can be adversely affected.
Coming from:
--https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events#Bandwidth -- ooh shiny link
Considering this, I'd say yes, you probably should.