Remote Event firing too much (lots of latency)

I’m currently making a game that involves a weapon system that doesn’t use tools: It instead uses weapons that are attached to the players’ hands. When the players’ input scripts detect a click, they fire a remote event to a server script that handles weapon firing (obviously with a cooldown equal to the weapon’s fire rate).

This, in turn, causes a problem. There are certain weapons with quick fire rates (such as 0.2 seconds) that cause the remote event to fire repeatedly, causing latency. This combined with multiple players firing weapons at the same time causes a ton of latency on the players’ clients. My game also has other things that use remote events, but are not fired nearly as often (such as an EquipEvent for equipping tools from the inventory). I want to reduce latency on other clients, so I suppose I need to modify my weapon system in some way.

game.ReplicatedStorage.RemoteEvents.M1Event.OnServerEvent:Connect(function(player,weaponType,weaponName,holdTime)

I still want to keep the original functionality of the remote event, as it transfers lots of information from the original client input script.

What alternatives do I have to using the RemoteEvent? Right now, the game would be really hard to play with multiple people due to

Player appears to be spamming RemoteEvents.
2 Likes

Instead of requesting a bullet to be shot to the server, send a message to “shoot” and “stop shooting”.

3 Likes

1.Have a debounce to prevent players from spamming
2.Great suggestion from @Quwanterz , try what he’s said

1 Like

What exactly do you mean by this? (also it’s not a gun game, it’s swords, staffs, and bows)

1 Like

maybe u could try migrating ur project to bridgenet2 or lbconnection bec they both have built-in ratelimiters for u to turn on or off

1 Like

I like this idea, maybe I could pair it with what the first person (@Quwanterz) said, but I don’t fully understand what they’re saying.

1 Like

like he wants u to send the strings to confirm to stop the player from shooting or allowing them
on the server to minimize data transfers

2 Likes

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