When I have two people in a server every remote event fires twice even when only one person activates it

when I join my game by itself each remote event fires once but when my friend joins, they all fire twice and three players fires three times. Someone else had a similar problem with no solution

1 Like

Can you provide us more info? Maybe your script or smth like that? That can be probably because you are using for i,v in Players:GetPlayers() do . i mean smth like that:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function()
	for i,v in Players:GetPlayers() do --"v" is our player
		game.ReplicatedStorage.RemoteEvent:FireClient(v) --[[
!!this remote event is just prints(1) on local script in the StarterPlayer.
if you will test it with 3 client sides servers you will see that it works
once for the first player, twice for the second player, thrice for the third player.
]]
	end
end)

or when a player activates an event it runs as many times as there are players on the server. ( because of for i,v in Players:GetPlayers() do ). Take a look at your script and I hope you will find a solution.

Localscript:

while wait() do
	wait(1-(game.Players.LocalPlayer.extras.speed.Value*0.05))
	game.ReplicatedStorage.mps:FireServer(game.Players.LocalPlayer)
	print("sent")
end

Script:

game.ReplicatedStorage.mps.OnServerEvent:Connect(function(allplayers, plr)
	print("recieved")
	if plr.extras.premium.Value == true then
		if plr.extras.mps.Value < 5 then
			plr.leaderstats.Money.Value += math.round(plr.extras.mps.Value * 1.5)
		elseif plr.extras.mps.Value >= 5 then
			plr.leaderstats.Money.Value += math.round(((plr.extras.mps.Value) * ((plr.extras.stars.Value * .2)+1))*1.5)
		end
	elseif plr.extras.premium.Value == false then
		if plr.extras.mps.Value < 5 then
			plr.leaderstats.Money.Value += math.round(plr.extras.mps.Value)
		elseif plr.extras.mps.Value >= 5 then
			plr.leaderstats.Money.Value += math.round((plr.extras.mps.Value) * ((plr.extras.stars.Value * .2)+1))
		end
	end
end)

I found the problem, I put the script in startergui which puts it in every player.

Thanks for the reply lol because I was so confused

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