Question About Tables

Hey there!

I’m not sure where to start, but I need to search for the player’s user id in the table once joined.
Here’s the current code I have:


game.Players.PlayerAdded:Connect(function(player)
	if player.UserId == 
end)

I have no idea what else to do.

Thanks,
Ben

I’m not entirely sure what you’re asking. What table are you meaning?

Forgot to include that, sorry!
local bannedUserIds = {198955588}

You can use table.find to search for the player’s userid in that table:

game.Players.PlayerAdded:Connect(function(player)
	if table.find(TableName, player.UserId) then
        print(player.. " says hi!")
       end
end)
1 Like

In order to check if their number is in the table, you could do something like this:

if table.find(bannedUserIds, player.UserId) then
    -- do something kick them idk
end