So I have made a door with this script. So when I click on it the door swings open. Tho I want it to make it so when door is open and I click on it will close again to the same postion, how could I do this?
local Door = script.Parent.Parent
local Main = Door.Main
local Button = script.Parent
local Opened = false
Button.ClickDetector.MouseClick:connect(function()
if Opened == false then
Opened = true
for i = 0,3,.1 do
Door:SetPrimaryPartCFrame(Door:GetPrimaryPartCFrame() * CFrame.Angles(0,math.rad(math.pi/1),0))
wait()
end
end
end)

2 comments
Else statement?
Not sure how i'm gonna use that in there