Remote Event from client to server received too many times

  1. I want to fire an event from a local script in StarterPlayerScripts to the server and have it received only one time by the server from the player who sent it.

  2. Every time I test in a server, if one player does a FireServer, it is received with the correct data, but duplicated for the amount of players that are in the server.

  3. I’ve looked on the developer forum pretty much all day, and a solution which could possibly fix my issue is if I disconnected the event in the server script after receiving data, finished doing my code on the data, then reconnected to the event again, but as this is an event which may be firing many times for multiple players, I wouldn’t want other players to have their events data blocked while it is working on a single player. I’m new to coding on roblox so it could be the case that the server only handles one thing at a time anyway, which in that case I could try the solution since there would be no performance decrease.

Are you sure your not calling :FireServer() multiple times? Normally an OnServerEvent only fires per player and not one player fires = all player fires

1 Like

It’s called one time, and I don’t have any loops which run for the number of players in the server.

But if you confirm thats how fireserver works, then I can try to put some debouncing on the function that fires it clientside, but it’s impossible to reproduce in the studio test, or in a published game with just 1 person. As soon as the player count in the studio local server or published game reaches 2, itll fire twice, 3 players will fire to the server 3 times, and so on. Each time with duplicate data, and if I print the player ID, from the same player. The local script has no access to the amount of players in the game, so I’m confused on how it would repeat the event. Also for extra info, remote event is in Replicated Storage.

1 Like

Yeah, the server isn’t another client. But if you’re putting the :FireServer() in a for loop looping through game.Players, then you’re doing it wrong. Instead fire it once because you want to fire it for that one person.

hmmmm. Show the code for this one, idk

Took my first break all day and I had a brain blast. Event connection on the server was on player added, there was a new connection each time a player joined. Solved.

1 Like