When the DoorHandle is clicked, a sound should play and the door should open. After 5 seconds, another sound plays and the door closes.
But, when I click the DoorHandle, only the sound plays but the tween does not, therefore not opening the door.
There were no errors on the output, there are two DoorHandles on each side of the door, with the same children and same scripts, I also checked on the Developer Forum but they didn't know what was the problem.
local tweenService = game:GetService("TweenService") local doorFrame = script.Parent.Parent.DoorFrame local phantomDoorFrame1 = script.Parent.Parent.PhantomDoorFrame1 local phantomDoorFrame2 = script.Parent.Parent.PhantomDoorFrame2 local clickDetector = script.Parent.ClickDetector local tweeningInformation1 = TweenInfo.new( 0.834, -- Duration Enum.EasingStyle.Back, -- Easing style Enum.EasingDirection.Out, -- Easing Direction 0, -- Number of repetitions false, -- Reverse boolean 0 -- Delay time between each repetition ) local partProperties1 = { CFrame = phantomDoorFrame1.CFrame } local partProperties2 = { CFrame = phantomDoorFrame2.CFrame } local tween1 = tweenService:Create(doorFrame, tweeningInformation1, partProperties1) local tween2 = tweenService:Create(doorFrame, tweeningInformation1, partProperties2) function openDoor() local doorOpenSound = script.Parent.Parent.DoorFrame.DoorOpen local doorCloseSound = script.Parent.Parent.DoorFrame.DoorClose local debounce = false if debounce == false then doorOpenSound:Play() tween1:Play() debounce = true wait(5) debounce = false if debounce == false then doorCloseSound:Play() tween2:Play() end end end clickDetector.MouseClick:Connect(openDoor)
I also used print() to look for a faulty line of code, here it is
if debounce == false then doorCloseSound:Play() tween2:Play() end