Remote event invocation queue exhausted

error outputs
Remote event invocation queue exhausted for Workspace.FNFStage.Events.Player2Hit; did you forget to implement OnClientEvent? (256 events dropped)

Remote event invocation queue exhausted for Workspace.FNFStage.Events.Player1Hit; did you forget to implement OnClientEvent? (256 events dropped)

local wait = function(n)
	n = n or 0
	assert(typeof(n)=="number", "Argument 1 must be a number")
	local s = tick()
	repeat game["Run Service"].Stepped:Wait() until tick()-s >= n
	return tick()-s
end

local player = script:FindFirstAncestorOfClass("Player")
local ui = script.Parent
local events = ui.Events
local config = ui.Config
local input = events.UserInput
local stage = ui.Stage.Value
local side = ui.Game:FindFirstChild(ui.PlayerSide.Value)
config.ObjectCount.Value = #ui:GetDescendants()

ui.Game.Visible = false

config.ServerSetup.Value = true

local function updatepoints()
	local lower = ui.LowerContainer
	local p1, p2 = stage.Config.P1Points.Value, stage.Config.P2Points.Value
	local total = p1+p2

	lower.PointsA.Text = ""..p1
	lower.PointsB.Text = ""..p2

	lower.PointsA.Overlay.Text = ""..p1
	lower.PointsB.Overlay.Text = ""..p2

	if p1 == 0 and p2 == 0 then
		lower.Bar.Background.Fill.Size = UDim2.new(0.5,0,1,0)
	else
		lower.Bar.Background.Fill.Size = UDim2.new(p1/total,0,1,0)
	end
end

updatepoints()

repeat wait() until stage.Config.Song.Value

ui.Game.Visible = true

--\\ Game

local basesong = game.HttpService:JSONDecode(stage.Config.Song.Value.Value)
local song = basesong.song

song.speed = song.speed or 1
song.bpm = song.bpm or 120

local function tomilseconds(seconds)
	return seconds*1000
end

local function toseconds(milliseconds)
	return milliseconds/1000
end

local function iseven(num)
	if math.floor(num) % 2 == 0 then return true else return false end
end

local function notetypeconvert(type)
	if tonumber(type) then
		if type == 0 then return "Left" end
		if type == 1 then return "Down" end
		if type == 2 then return "Up" end
		if type == 3 then return "Right" end
		if type > 3 then 
			return notetypeconvert(type-4), true
		end
	end
end

local templates = ui.Game.Templates

--\\ Ready Set Go

spawn(function()
	stage.MusicPart["2"].Played:Wait()
	ui.Ready.Visible = true

	stage.MusicPart["1"].Played:Wait()
	ui.Ready.Visible = false
	ui.Set.Visible = true

	stage.MusicPart["Go"].Played:Wait()
	ui.Set.Visible = false
	ui.Go.Visible = true

	spawn(function()
		wait(1 / song.speed)
		ui.Go.Visible = false
	end)
end)

--\\ Notes

repeat game["Run Service"].Stepped:Wait() until stage.Config.TimePast.Value > -4 / song.speed

local currentarrows = {}

local time = 1.75

spawn(function()
	local notes = basesong.notes or song.notes
	
	local printDebounce = false
	while wait() do
		updatepoints()

		--\\ Debugging

		if stage.Config.CleaningUp.Value then return end
		
		--\\ Notes
		for sectionnum, section in pairs(notes) do
			for notenum, note in pairs(section.sectionNotes) do
				local timeposition 	= note[1]
				local notetype 		= note[2]
				local notelength	= note[3]
				local timeframe = tomilseconds(time / song.speed)
				local timepast = tomilseconds(stage.Config.TimePast.Value)
				
				if timepast > timeposition - timeframe and timeposition and notetype and notelength then
					local side = section.mustHitSection
					local actualnotetype, oppositeSide = notetypeconvert(notetype)

					if oppositeSide then side = not side end
					side = side and "R" or "L"

					if not oppositeSide then ui.Side.Value = side end

					--\\ Delete note from table
					table.remove(section.sectionNotes, notenum)

					--\\ Add note to game
					local slot = templates[actualnotetype]:Clone()
					--slot.Frame.Bar.Size = UDim2.new(0.325,0,notelength/1000/song.speed,0)
					slot.Position = UDim2.new(1,0,6.666,0)
					slot.Parent = ui.Game[side].Arrows.IncomingArrows

					local tweeninfo = {time * (2 / song.speed),Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0}
					local properties = {Position=UDim2.new(1,0,-6.666,0)}

					events.TweenArrow:FireClient(player, slot, tweeninfo, properties)
					currentarrows[slot] = tick()

					spawn(function()
						wait(time * (2 / song.speed))
						slot:Destroy()
					end)
				else
					if not printDebounce then
						printDebounce = true
						spawn(function()
							wait(1)
							printDebounce = false
						end)
					end	
				end
			end
		end
	end
end)

--\\ Input
local remoteEvent = stage.Events:WaitForChild("AddPoints")

local function addpoints(n, direction)
	remoteEvent:Fire(ui.PlayerSide.Value, n, direction)
end

input.OnServerEvent:Connect(function(invoker, direction, type, obj, position)
	if typeof(direction) ~= "string" then return end
	if typeof(type) ~= "EnumItem" then return end
	if obj == "missed" then addpoints(-50) return end
	if typeof(obj) ~= "Instance" then return end
	if typeof(position) ~= "UDim2" then return end

	if stage.Config.CleaningUp.Value then return end

	if invoker == player then
		local arrows = ui.Game[ui.PlayerSide.Value].Arrows.IncomingArrows
		for _, arrow in pairs(arrows:GetChildren()) do
			local dist = math.abs(position.Y.Scale)
			if arrow.Name == direction and arrow == obj and dist <= 1 and arrow.Frame.Arrow.Visible then
				arrow.Frame.Arrow.Visible = false

				--\\ Points

				if dist <= 0.075 then
					addpoints(500, direction) -- Sick!
					script.Parent.Sick.Visible = true
					wait(0.5)
					script.Parent.Sick.Visible = false
				elseif dist <= 0.25 then
					addpoints(350, direction) -- Good!
					script.Parent.Good.Visible = true
					wait(0.5)
					script.Parent.Good.Visible = false
				elseif dist <= 0.5 then
					addpoints(200, direction) -- Nice.
					script.Parent.Good.Visible = true
					wait(0.5)
					script.Parent.Good.Visible = false
				elseif dist <= 1 then
					addpoints(50, direction) -- Bad.
					script.Parent.Bad.Visible = true
					wait(0.5)
					script.Parent.Bad.Visible = false
				end

				--\\ Player Interaction
				local remoteEvent1 = stage.Events:WaitForChild("Player1Hit")
				local remoteEvent2 = stage.Events:WaitForChild("Player2Hit")

				if ui.PlayerSide.Value == "L" then
					remoteEvent1:FireAllClients(direction, type)
				end
				if ui.PlayerSide.Value == "R" then
					remoteEvent2:FireAllClients(direction, type)
				end
			end
		end
	end
end)

Might aswell say that there is a :FireClient() somewhere that doesn’t have a receiver callback.

1 Like

Could you rephrase what you are asking?

1 Like

Yeah, please, my brain hurts after reading this.

Sorry. I don’t know. Please use the model below and help.

Probably you forgot to setup a OnClientEvent for the remote event or you are firing the remote event way too quickly