Remote event not firing?

Hey all, so my remote event was working perfectly fine yesterday and now today it seems to not be firing.

local:

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.LeaveQueue:FireServer()
	print("hi")
end)

server:

game.ReplicatedStorage.LeaveQueue.OnServerEvent:Connect(function(plr)
	for index, name in ipairs(playersLookingForMatch) do
		if name == plr then
			table.remove(playersLookingForMatch, index)
			print("Player left queue!")
		end
	end
end)

Output when the button is clicked:

hi

I tested this while the player was already in the queue and it doesn’t do the second print.

Are there any errors in the output?

No errors at all. This is why it is puzzling.

You used in ipairs(), shouldn’t they only be used for arrays? I may be mistaken, but if not then in pairs() should be used instead.

this used to be working yesterday, which is what I don’t understand. Yes, the thing I’m using is an array of the players currently waiting inside a queue.

Assuming you aren’t storing the player objects in the table, you need to do this:
if name == plr.Name then

Currently, you’re checking if name (a string of the player’s name presumably) matches the player object. It’s obviously going to be the same as they’re different things. However, the name & the .Name property of the player object can match.

Also:

This isn’t how it works. ipairs is similar to pairs but when it finds an element in the array that is nil, it will stop whereas pairs won’t.

1 Like

You should really use WaitForChild() for getting LeaveQueue.
Also, you don’t need to check every single one of a table’s members. You can instead do it like this:

if table.find(playersLookingForMatch, plr) then --Check if the player exists in the table
    table.remove(playersLookingForMatch, table.find(playersLookingForMatch, plr)) --Remove the player from their spot
end