When you click on the button, it opens, then when you click the button but you didn’t wait for the cooldown, it still makes the noise.
Here is the script
– Door + Positions
local door = script.Parent.Door
local button = script.Parent.Button.Button
local posY = script.Parent.Pos1.Position
local posX = script.Parent.Pos2.Position
local debounce = true
local debounce2 = true
local doorSound = script.Parent.SlidingDoor
-- Tween
local tweenService = game:GetService("TweenService")
local tweenCreateX = tweenService:Create(door,TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{Position = posX})
local tweenCreateY = tweenService:Create(door,TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{Position = posY})
button.ClickDetector.MouseClick:Connect(function(player)
if debounce == true then
debounce = false
tweenCreateX:Play()
doorSound:Play()
wait(2)
button.ClickDetector.MouseClick:Connect(function()
tweenCreateY:Play()
doorSound:Play()
end)
debounce = true
end
end)