Table.remove() not removing or throwing error?

I’m making a speed boost pad. Once touched, if players are not on blacklist they receive a speed boost. They are then added to the blacklist for 4 seconds. Problem is table.remove() does not remove me from the blacklist table.

the script does not throw an error when it reaches the table.remove line but after that I am still printed on the blacklist

I’m not sure what the problem is. I’m not sure if I’m doing anything wrong or maybe forgetting something.

Any help would be appreciated, thanks in advance.


if Go_Kart ~= nil then
						local Velocity = Go_Kart:FindFirstChild("LinearVelocity", true)
						
						table.insert(Blacklist, players:FindFirstChild(Humanoid.Parent.Name, true).UserId)
						Active_Hits = Active_Hits + 1
						
						Velocity.VectorVelocity = Vector3.new(Velocity.VectorVelocity.X + Boost, Velocity.VectorVelocity.Y, Velocity.VectorVelocity.Z)
						Sound:Play()
						
						wait(Player_Boost_Cooldown)
						if table.find(Blacklist, players:FindFirstChild(Humanoid.Parent.Name, true).UserId) then 
							table.remove(Blacklist, players:FindFirstChild(Humanoid.Parent.Name, true).UserId) 
--problem line above.
print("Removed from blacklist!")
						end
						
						print("Active blacklist users = {")
						for a, b in ipairs(Blacklist) do
							print(b)
						end
						print("}")
--still printed on blacklist
						
						Active_Hits = Active_Hits - 1
					end

table.find returns the index, so remove the table[index], not table[thing]

local Find = table.find(Blacklist, players:FindFirstChild(Humanoid.Parent.Name, true).UserId) 

if Find then 
	table.remove(Blacklist, Find) 
	print("Removed from blacklist!")
end
1 Like

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