Problem WIth "Table" {Key Code door}

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hello! So i have {Door key Code}

1)So my idea is

Local Table_With_Accept_Cards = {Level_1, Level_2}

If player Tuch “Scanner” and put == Table_With_Accept_Cards then

Door open

  1. What is the issue? But problem is In Table i can put only 1 item Like

Part.BrickCollor = Color[1] or Part.BrickCollor = Color[2]

Not all Table

CODE

local KeyCardDoor = workspace.World:WaitForChild("Key Card Door")

local debounce = false

local door = KeyCardDoor.Door
local Scanner = KeyCardDoor.Scanner

local CardName_Accept  = {
	"Level_1",
	"Level_2"
}



local function CheckDoorTest(hit)
	if not debounce then
		if hit.Parent.Name == CardName_Accept[] then
			print("Accept")
			door.CanCollide = false
			door.Transparency = 0.5
			debounce = true
			wait(5)
			door.CanCollide = true
			door.Transparency = 0
			debounce = false
		end
	end
end



Scanner.Touched:Connect(CheckDoorTest)
  1. What solutions have you tried so far? i Searh About “Mate Tables” and just Table but it’s not work:(

use table.find

if table.find(CardName_Accept, hit.Parent.Name) then
1 Like

Wait i have Question?
Why we put in "Table.Find " All times

Why we not make like

hit.Parent.Name == Table.find(CardName_Accpet)

because table.find doesnt work like that,
table.find returns the position in the table of the found item so you would be comparing a name to the position the item is in inside of the table