Hey all!
I made a script where you can click to open and close a set of doors. One of the doors opens and closes, but the other only opens. Any reason for this?
Script for both doors:
local frame = script.Parent
local clickDetector = frame:WaitForChild("ClickDetector")
local model = frame.Parent
local Close = model:WaitForChild("DoorClose")
local Open = model:WaitForChild("DoorOpen")
local opened = model:WaitForChild("Opened")
local tweenService = game:GetService("TweenService")
local debounce = true
clickDetector.MouseClick:Connect(function()
if debounce == true then
debounce = false
if opened.Value == true then
opened.Value = false
tweenService:Create(frame,TweenInfo.new(0.65),{CFrame = Close.CFrame}):Play()
else
opened.Value = true
tweenService:Create(frame,TweenInfo.new(0.65),{CFrame = Open.CFrame}):Play()
end
wait(0.65)
debounce = true
end
end)