I made multiple cards and multiple doors for different levels, but when I remove "L1" from the script, it's still able to be used, but the light still turns red.
if plr.Character:FindFirstChild("L1") or plr.Character:FindFirstChild("L2") or plr.Character:FindFirstChild("L3") then
first door
if plr.Character:FindFirstChild("L2") or plr.Character:FindFirstChild("L3") then
second door
Full Script:
local TweenService = game:GetService("TweenService") local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0) local ProximityPromptService = game:GetService("ProximityPromptService") ProximityPromptService.PromptTriggered:Connect(function(prompt, plr) if prompt.Name == "keycardDoor" then local sensor = prompt.Parent.Parent local door = sensor.Parent.door local Border = sensor.Parent.door.Border local Symbol = sensor.Parent.door.Symbol if plr.Character:FindFirstChild("L1") or plr.Character:FindFirstChild("L2") or plr.Character:FindFirstChild("L3") then sensor.light.BrickColor = BrickColor.new("Lime green") TweenService:Create(door.PrimaryPart, TweenInfo.new(2), {Position = door.PrimaryPart.CFrame * Vector3.new(5.1,0,0)}):Play() TweenService:Create(Border, TweenInfo.new(2), {Position = Border.CFrame * Vector3.new(0,5.1,0)}):Play() TweenService:Create(Symbol, TweenInfo.new(2), {Position = Symbol.CFrame * Vector3.new(5.1,0,0)}):Play() wait (3) TweenService:Create(door.PrimaryPart, TweenInfo.new(2), {Position = door.PrimaryPart.CFrame * Vector3.new(-5.1,0,0)}):Play() TweenService:Create(Border, TweenInfo.new(2), {Position = Border.CFrame * Vector3.new(0,-5.1,0)}):Play() TweenService:Create(Symbol, TweenInfo.new(2), {Position = Symbol.CFrame * Vector3.new(-5.1,0,0)}):Play() sensor.light.BrickColor = BrickColor.new("Bright red") else sensor.light.BrickColor = BrickColor.new("Bright red") wait(1) sensor.light.BrickColor = BrickColor.new("Bright red") end end end)
It seems like you want to disable the door when the "L1" card is removed from the script. To do that, you can simply remove "L1" from the condition in line 11.
For example, if you only want the door to be opened with the "L2" and "L3" cards, you can change line 11 to:
```lua if plr.Character:FindFirstChild("L2") or plr.Character:FindFirstChild("L3") then ```
Now the door should not open when the player has the "L1" card in their character. The light will still turn red, as it's set to do so in lines 26-28. If you want to change the light's behavior, you can modify those lines accordingly.