So, I’m making a keycard system based door.
[coding hell warning]
local prompt = script.Parent
local doorModel = script.Parent.Parent.Parent.Parent.Parent
local door1 = doorModel.Doors.Door1
-- > SETUP < --
local door2 = doorModel.Doors.Door2
local doorT1 = doorModel.Doors.TargetD1
local doorT2 = doorModel.Doors.TargetD2
local closePos1 = doorModel.Doors.Door1.Position
local closePos2 = doorModel.Doors.Door2.Position
local keycardLight1 = doorModel.KeycardReader1.Func.KeycardLight
local keycardLight2 = doorModel.KeycardReader2.Func.KeycardLight
local cards = {
["LightAccessKeycard"] = true,
["MediumAccessKeycard"] = true,
["HeavyAccessKeycard"] = true,
["HostileHackBypasser"] = true,
["AdminBypasser"] = true;
}
-- > TWEENING < --
local tweenService = game:GetService("TweenService")
local goal1 = {}
local goal2 = {}
local goalclose1 = {}
local goalclose2 = {}
goal1.Position = doorT1.Position
goal2.Position = doorT2.Position
goalclose1.Position = closePos1
goalclose2.Position = closePos2
local InfoD1 = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0)
local InfoD2 = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0)
local tweenD1 = tweenService:Create(door1, InfoD1, goal1)
local tweenD2 = tweenService:Create(door2, InfoD1, goal2)
local tweenClse1 = tweenService:Create(door1, InfoD1, goal1)
local tweenClse2 = tweenService:Create(door2, InfoD1, goal2)
-- > CODE < --
prompt.Triggered:Connect(function(plr)
local debounce = doorModel.IsMoving.Value
local char = plr.Character or plr.CharacterAdded:Wait()
print("Debounce check.")
if debounce then return end
print("No debounce.")
debounce = true
local plrBackpackContent = plr.Backpack:GetChildren()
print("Children obtained.")
for i,tool in pairs(plrBackpackContent) do
print(tool.Name)
if tool:IsA("Tool") then
if table.find(plrBackpackContent,cards) then
print("Checking tools..")
for i,card in pairs(cards) do
if card then
print("Success!")
keycardLight1.Color = Color3.fromRGB(26, 255, 0)
keycardLight2.Color = Color3.fromRGB(26, 255, 0)
tweenD1:Play()
tweenD2:Play()
tweenD1.Completed:Wait()
tweenD2.Completed:Wait()
keycardLight1.Color = Color3.fromRGB(255, 0, 4)
keycardLight2.Color = Color3.fromRGB(255, 0, 4)
task.wait(2)
tweenClse1:Play()
tweenClse2:Play()
tweenClse1.Completed:Wait()
tweenClse2.Completed:Wait()
debounce = false
else
print("Invalid card inserted by: "..plr.Name)
end
end
end
end
end
end)
However, after this part:
print(tool.Name)
It just doesn’t continue after that. I do not know why. Could anyone help out?