So the problem is pretty evident in the title. I’ve got a remote event and say there are four people in-game, that event should only fire once fires four times (or the equivalent of the # of players in-game.), and this happens dynamically with any number of players.
I’ve checked over my code over 20 times, and that’s not an over-exaggeration; there is positively nothing anywhere that could be causing this to happen but Roblox itself, and I want a fix for it.
That said, if you guys need any details about the location of the script etc. ill be glad to provide but I checked to make sure that wasn’t the issue either.
This is pretty straight forward, you have a LocalScript which fires the RemoteEvent once it runs. But that LocalScriptwill run for each single player therefore firing the remote #players amount of times. If you want the remote to only fire once after it’s fired for the first time, disconnect the server event(that way if it’s fired again the server script will ignore it):
local Remote = game.ReplicatedStorage.ShopRemote
local connection
connection = Remote.OnServerEvent:Connect(function(player, ...)
--check if the event is valid, and it wont fail
connection:Disconnect()
--run the code
end)
PS: You can also destroy the remote, but it may break your client scripts if they rely on it.
It doesn’t fire as soon as the script runs; it waits for a user to click a button, then fires. The script is placed inside of a ScreenGui. And the remote event is designed to be used throughout the server’s lifespan. not just a few times
I’m not sure if I explained this correctly, but it fires the number of players times to the server and back.
If it fires #players times for each player you may have a player loop around the remote or the server(although that’s just a guess, without the code snippets we can’t do much).
theres no loops based on the # of players whatsoeover. i checked all the scripts it doesnt mention the number of players anywhere within the remote events.