01 | --<tkcmdr>-- |
02 |
03 | local door = script.Parent |
04 | local bool = true |
05 | local bool 2 = true |
06 | local clearance = { |
07 | [ "[SCP] Card-Omni" ] = true , |
08 | [ "[SCP] Card-L5" ] = true , |
09 | [ "[SCP] Card-L4" ] = true , |
10 | [ "[SCP] Card-L3" ] = true , |
11 | [ "[SCP] Card-L2" ] = false , |
12 | [ "[SCP] Card-L1" ] = false , |
13 | [ "[SCP] MTF Access Card" ] = false , |
14 | [ "[SCP] O5-2 Access Card" ] = true , |
15 | [ "[SCP] ET Card" ] = false , |
The problem is in your if statements. When you are using or you are forgetting that it is a whole new check system. Let me explain with a little code:
1 | --here is an if statement: |
2 | if player.Name = = "Name" then -- this works |
3 | --let's create a new if statement but this time with two names |
4 | if player.Name = = "Name" or "Name2" then -- this always lets the player through. |
5 | -- Why?!?! ugh this is so frustrating |
The reason is that when you use or you are in essence creating a new if statement. It is like saying:
1 | if "Name2" then |
and that will always pass. Why? Because a string is truthy. It is not false or nil and seems true to the if statement because it exists. What you will need to do is:
1 | if player.Name = = "Name" or player.Name = = "Name2" then |
and it works. There is a problem though. If you have a lot of names this will take forever to write and will look extremely ugly. I recommend having a table of names and looping through it. Here is the function I use:
01 | local admins = { "Name1" , "Name2" } |
02 | local function isAdmin(plr) |
03 |
04 | for i,v in pairs (admins) do |
05 |
06 | if v = = plr.Name then |
07 |
08 | return true |
09 |
10 | end |
11 |
12 | end |
13 |
14 | return false |
15 |
16 | end |
17 | if isAdmin(player) then |
18 | -- this is a cleaner way to do it when you have a lot of names. Maybe not so worth it if you have two names. But three and beyond can benefit. |
Hope this helps and have a great day scripting!
As far as I am concerned, more then 1 "or" statement doesn't work... Correct me if I am wrong, but I am pretty sure. So line 49 and 55 are not working.