i literally JUST started making the doors for the office, and for some reason the on/off switch (indicated by the active variable) doesn't work. After using breakpoints and teh watch window i came to the conclusion that the cooldown (cd) does not return to being false after being set to true. You can see this in the watch window ofcourse. On top of that, putting a breakpoint on the elseif statement does not work either, its almost as if the program is ignoring that line entirely. Im not really sure how is that even possible. I do also kinda have an hypotesis that the cd not being active might be the direct cause as of why the esleif is being ignored, but i've yet to prove that.
local RS = game:GetService("ReplicatedStorage")
local Remotes = RS:WaitForChild("Remotes")
local TS = game:GetService("TweenService")
local DoorActivationRemRight = Remotes:WaitForChild("DoorActivationR")
DoorActivationRemRight.OnServerEvent:Connect(function(plr, RightDoor, RDoorButton)
local cd = false
local active = false
if active == false and cd == false then
cd = true
task.delay(0.2, function()
cd = false
end)
active = true
print(active)
local RDoorTweenON = TS:Create(RightDoor, TweenInfo.new(0.5), {CFrame = RightDoor.CFrame * CFrame.new(0, 50, 0)})
RDoorTweenON:Play()
elseif active == true and cd == false then
cd = true
task.delay(0.2, function()
cd = false
end)
active = false
print(active)
local RDoorTweenOFF = TS:Create(RightDoor, TweenInfo.new(0.5), {CFrame = RightDoor.CFrame * CFrame.new(0, -50, 0)})
RDoorTweenOFF:Play()
end
end)