--<tkcmdr>-- local door = script.Parent local bool = true local bool2 = true local clearance = { ["[SCP] Card-Omni"] = true, ["[SCP] Card-L5"] = true, ["[SCP] Card-L4"] = true, ["[SCP] Card-L3"] = true, ["[SCP] Card-L2"] = false, ["[SCP] Card-L1"] = false, ["[SCP] MTF Access Card"] = false, ["[SCP] O5-2 Access Card"] = true, ["[SCP] ET Card"] = false, ["[SCP] Card-Dev"] = true } function openDoor() script.Parent.DoorOpen:play() for i = 1,(door.Size.z / 0.12) do door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.12) wait() end door.Transparency = 1 for i,v in pairs(door:GetChildren()) do if v:IsA("Decal") then v.Transparency = 1 end end wait(3) door.Transparency = 0 for i,v in pairs(door:GetChildren()) do if v:IsA("Decal") then v.Transparency = 0 end end script.Parent.DoorClose:play() for i = 1,(door.Size.z / 0.12) do wait() door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.12) end end script.Parent.Parent.Door.touched:connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') and bool then local plr = workspace[hit.Parent.Name] local player = game.Players:GetPlayerFromCharacter(plr) if player.Name == "tictac67" or "tolly67" or "MINECRAFT_LOLBUILDZ" then bool = false script.Parent.AccessGranted:Play() openDoor() wait(1) bool = true elseif player.Name ~= "tictac67" or "tolly67" or "MINECRAFT_LOLBUILDZ" and bool2 then bool2 = false script.Parent.AccessDenied:play() wait(1) bool2 = true end end end)
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:
--here is an if statement: if player.Name == "Name" then -- this works --let's create a new if statement but this time with two names if player.Name == "Name" or "Name2" then -- this always lets the player through. -- 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:
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:
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:
local admins = {"Name1", "Name2"} local function isAdmin(plr) for i,v in pairs(admins) do if v == plr.Name then return true end end return false end if isAdmin(player) then -- 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.