So I’m working on a project here inspired by The Division, and with it there’s features that require usages from the server, which means using remote events. I found a bug that I can’t fix however, when there’s only one player using the watch, everything works just fine. But when 2 players use the watch, the remote events I use seem to fire twice instead of just once?
Below is a 7 second clip showing me opening the watch which fires a remote event to the server, which then prints “Recieved ISAC event!”. As you can see, when there’s two people with the watch, it prints twice. But when it’s just me, it only prints once.
Below is the code regarding opening the menu:
if input.KeyCode == Enum.KeyCode.Tab and inmenu == false and loadingup == false and czactive ~= true then
inmenu = true
sfx.LOAD_IN:Play()
base.ISAC_MENU.Visible = true
ts:Create(base.ISAC_MENU, TweenInfo.new(0.1), {Size = UDim2.new(0.655, 0, 0.759, 0)}):Play()
equipanim:Play()
rs.Events.ISAC:FireServer("MENU", "OPEN")
If you need additional details, please let me know. This one is frustrating for me.
How many times is the function getting run? Maybe the script restarts and then it ends up firing twice due to the function listening more than once, if you understand what im trying to say
I attach the function to the inputbegan event with userinputservice. So the only time the event gets fired is when a player presses Tab. So I’m not so sure why it would be listening more than once. It’s a local script too.
Check if the remote actually is firing twice and that’s it’s not just something in the server script. Maybe try putting a print inside the function that handles the remote.