I tried making an elevator script (only the floor moves). It has two buttons, up and down. It works, but the problem is the cooldown. When you click up, you can still click down and it forces the elevatorfloor to go down even if it's still going up. Same thing vice versa. The problem is possibly debounces and cooldowns, but i'm like,, absolutely hoRRIBLE with that. A little help?
local TweenService = game:GetService("TweenService")
local up = script.Parent.eup
local down = script.Parent.edown
local elevatorfloor = game.Workspace.Elevatorfloor
local tweeninfo = TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0)
local debounce = false
local elevatorfloordown = {CFrame = CFrame.new(-209, 0.7, -92.77)}
local elevatorfloorup = {CFrame = CFrame.new(-209, 22.91, -92.77)}
local tween1up = TweenService:Create(elevatorfloor,tweeninfo,elevatorfloorup)
local tween2down = TweenService:Create(elevatorfloor,tweeninfo,elevatorfloordown)
up.ClickDetector.MouseClick:Connect(function()
if debounce == false then
debounce = true
tween1up:Play()
tween1up:Enum.PlaybackState.Completed
debounce = false
end)
down.ClickDetector.MouseClick:Connect(function()
if debounce == false then
debounce = true
tween2down:Play()
tween2down:Enum.PlaybackState.Completed
debounce = false
end)

1 comment
I edited my answer