Hello, developers
I’m currently trying to build a map voting system for my game
I’m trying to remove a vote when a player leaves but table.find() returns nil even if the object exists
The code is in a ModuleScript
local module = {}
module.forestVoters = {}
module.canyonVoters = {}
-- other code here
function module.removeVoter(username)
print(module.forestVoters, module.canyonVoters)
if table.find(module.forestVoters, username) then
table.remove(module.forestVoters, table.find(module.forestVoters, username))
script.Parent.ForestPad.pad.votes.Value -= 1 -- this is the value that points to how many votes the map has
elseif table.find(module.canyonVoters, username) then
table.remove(module.canyonVoters, table.find(module.canyonVoters, username))
script.Parent.CanyonPad.pad.votes.Value -= 1
else
warn("cannot find user")
end
end
-- other code here
return module
and this is the code that runs the function
local handler = require(script.Parent.voteHandler)
game.Players.PlayerRemoving:Connect(function(username)
handler.removeVoter(username)
end)
in the output it shows that my username is in the table but it can’t find it inside the table

If you have any questions let me know
Thanks