local TS = game:GetService("TweenService")
local hinge = game.Workspace.D1.Hinge
local key = script.Parent
local debounce = false
key.Touched:Connect(function(hit)
local name = hit.Parent.Name
if name == "Level 1 Keycard" then
script.Parent.Parent.neon.Color = Color3.new(1, 0, 0.0156863)
wait(0.5)
script.Parent.Parent.neon.Color = Color3.new(0.14902, 1, 0)
return
elseif name == "Level 2 Keycard" or "Level 3 Keycard" or "Level 4 Keycard" or "Level 5 Keycard" then
if debounce == false then
debounce = true
local TSInfo = TweenInfo.new(2,Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local tweenanim = TS:Create(hinge, TSInfo, {CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)})
wait(0.5)
tweenanim:Play()
wait(6)
local newTSInfo = TweenInfo.new(2,Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local newanim = TS:Create(hinge, newTSInfo, {CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(-90), 0)})
wait(0.5)
newanim:Play()
wait(5)
if debounce == true then
debounce = false
end
end
end
end)
why roblox?

3 comments
try to use prints to find more information
Line 14, you can't do that. You're saying: if name == "Level 2 Keycard" then continue, or if "Level 3 Keycard" then continue. And so on. Meaning you're not checking if the name equals the other strings, you're just checking the strings.
So on line 14 it will continue regardless of what "name" equals. Because the other strings exist and are possible. If you try on a new script, you can write: if "Hello" then print("yes") end, and it wil print