Remote Event Recieved multiple times but fired once

Hello!

I have got a server script where it fires WaitLavaRem to all clients

  WaitLavaRem:FireAllClients(LavaRise)

This is a round system and it fires once per round. The first two rounds work fine but on the third round it fires once and receives twice, the fourth round, fires once receives thrice. ETC

Server Script:

local timer = 20

AddRemoveTimeRem.OnServerEvent:Connect(function(player, Time, Action)
	if Action == "Add" then
		timer += Time
	elseif Action == "Remove" then
		timer -= Time
	end
	timer = math.max(timer, 0)
	print(timer)
end)

local function PlayOneRound()
	-- refill planes if needed
	while true do
		if not TotalPlanes or #TotalPlanes == 0 then
			print("Refilling TotalPlanes")
			TotalPlanes = table.clone(PlaneModule)
		end

		local RandomPlane = math.random(1, #TotalPlanes)
		local SelectedPlane = TotalPlanes[RandomPlane]
		table.remove(TotalPlanes, RandomPlane)

		GetCurrentPlaneFunc.OnServerInvoke = function()
			return SelectedPlane.Name
		end

		print("Plane selected: " .. SelectedPlane.Name ..
			", Category: " .. SelectedPlane.Category ..
			" with length of " .. SelectedPlane.Length)

		ChangeUIRem:FireAllClients(SelectedPlane)
		WaitLavaRem:FireAllClients(LavaRise) -- this is the remote it fires
		print("Fired WaitLavaRem")

		LavaRise = math.ceil(LavaRise * LavaMulti)

		task.wait(3)

		-- reset timer for this round
		timer = 20

		-- Countdown loop
		while timer > 0 do
			UpdateTimerRem:FireAllClients(timer, SelectedPlane)
			task.wait(1)
			timer -= 1
		end

		UpdateTimerRem:FireAllClients(0, SelectedPlane)

		-- Lava tween
		local TweenService = game:GetService("TweenService")
		local GoalSize = Lava.Size + Vector3.new(0, LavaRise, 0)
		local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
		local SizeTween = TweenService:Create(Lava, tweenInfo, {Size = GoalSize})
		SizeTween:Play()
	end
	
end

-- kill players who touch lava
local function onTouch(otherPart)
	local character = otherPart.Parent
	local player = game.Players:GetPlayerFromCharacter(character)
	if player then
		local humanoid = character:FindFirstChild("Humanoid")
		if humanoid then
			humanoid.Health = 0
		end
	end
end
Lava.Touched:Connect(onTouch)

-- start the first round
PlayOneRound()

-- when WinRem is fired, start the next round
WinRem.OnServerEvent:Connect(function(plr)
	task.wait(1)
	PlayOneRound()
end)

Local Script:

local debounce = false
WaitLavaRem.OnClientEvent:Connect(function(LavaRise)
		if debounce then return end
		debounce = true
		print("Lava Finished")
		Letters.Visible = false
		TextBox.Parent.Visible = false
		PlaneImage.Visible = false
		Category.Visible = false
		GuessText.Visible = false
		TimerText.Visible = false
		
		
		
		local Info3= TweenInfo.new(

			0.5,
			Enum.EasingStyle.Cubic,
			Enum.EasingDirection.In,
			0,
			false,
			0

		)

		local Goal3 = {

			Position = UDim2.new(0.337,0,-0.2,0)

		}
		
		
		local MoveIntermission = TS:Create(IntermissionGui.MainFrame, Info3, Goal3)
		MoveIntermission:Play()
		Whoosh:Play()
		MoveIntermission.Completed:Wait()
		IntermissionGui.MainFrame.Visible = false
		
		-- og pos {0.337, 0},{-0, 0}
		local GuessGui = player:WaitForChild("PlayerGui"):WaitForChild("GuessGUI")
		if GuessGui then
			print("FoundGuessGui")
			GuessGui.Enabled = true
		end
		
		
		Lavarise.Visible = true
		Lavarise.Position = UDim2.new(0.337,0,-0.2,0)
		
		local Info = TweenInfo.new(
			
			0.5,
			Enum.EasingStyle.Cubic,
			Enum.EasingDirection.In,
			0,
			false,
			0
			
		)
		
		local Goal = {
			
			Position = UDim2.new(0.337, 0, -0, 0)
			
		}
		
		local MoveLavaTween = TS:Create(Lavarise, Info, Goal)
		MoveLavaTween:Play()
		Whoosh:Play()
		
		Lavarise.TextLabel.Text = "LAVA WILL RISE ".. LavaRise.. " BLOCKS THIS ROUND"
		
		task.wait(3)
		
		local Info2 = TweenInfo.new(

			0.5,
			Enum.EasingStyle.Cubic,
			Enum.EasingDirection.In,
			0,
			false,
			0

		)

		local Goal2 = {

			Position = UDim2.new(0.337,0,-0.2,0)

		}
		
		local MoveLavaTween2 = TS:Create(Lavarise, Info2, Goal2)
		MoveLavaTween2:Play()
		Whoosh:Play()
		MoveLavaTween2.Completed:Wait()
		
		
		Lavarise.Visible = false
		Letters.Visible = true
		TextBox.Parent.Visible = true
		PlaneImage.Visible = true
		Category.Visible = true
		GuessText.Visible = true
		TimerText.Visible = true
	
		AddTimeBTN.Visible = true
		RemoveTimeBTN.Visible = true		
		RevealAnswerBTN.Visible = true
		StealBlocksBTN.Visible = true
		
		GuessGui.Enabled = true
		debounce = false
	end)

The output should say fired WaitLavaRem once, on the client it prints Lava Finished multiple times.

All help is appreciated

There is quite a bit of code and I’m not quite sure the purpose of everything, so I’ll just point out a few things that stand out as likely culprits.

  1. Unsure of winrem fire condition. Is that triggering more than once causing multiple rounds to start at the same time?

  2. playOneRound() had an infinite loop that doesn’t end? So every round starts and runs independently, but keeps resetting itself. The winrem starts a new round anyways which means you are adding a new round every round since the old rounds don’t die off.

That’s all I really see. Both of those have the potential to be creating extra rounds running at the same time which is likely what’s causing this.

1 Like

Sounds like you’re connecting to the remote after the end of every round, and not disconnecting them, when does the local script run? Additionally check if the remote is actually being fired only once, when does WinRem get fired?

Put prints ahead of checks to see what the variable are.
For example on line 4 of the first script put print(Action) to see if the timer is getting set to 0 causing another round to be started immediately if fired twice.

Try the same thing on other lines so you can see if there’s something you didn’t expect to happen in each section of code.

The AddRemoveTimeRem is a dev product where users pay to either add or remote time from the round

The local script runs when ChangeUIRem is fired to all clients. The local script handles all ui for the round.

I added more print statements and all the print statements from the server script run once which is good and the first to rounds played, it prints once in the local script howver the next rounds somehow make the local script remote.onclientevent recieve twice then thrice then on and on.

Screenshot 2025-09-24 071940
Screenshot 2025-09-24 071920
Screenshot 2025-09-24 071914