Whenever the touched function is activated. the tween gets to line 18, doesnt wait and instantly does the second tween. the first tween seems to cancel out the second tween. making it so the second tween doesnt even happen. What is the issue?
local detectionZone = script.Parent
local debounce = false
local function onTouched(other)
local character = other.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
local tool = character:FindFirstChild("Card")
if humanoid and tool then
if debounce == true then return end
debounce = true
print("works?")
game:GetService("TweenService"):Create(game.Workspace.Door125Main, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CFrame = CFrame.new(-136.094, 1.524, -187.613) * game.Workspace.Door125Main.CFrame.Rotation}):Play()
wait(1)
game:GetService("TweenService"):Create(game.Workspace.Door125Main, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CFrame = CFrame.new(-132.394, 1.524, -187.613) * game.Workspace.Door125Main.CFrame.Rotation}):Play()
print("Tween REstart")
task.wait(3)
debounce = false
end
end
detectionZone.Touched:Connect(onTouched)