I have created a click to sit seat, but unless it has a 3 second cooldown it will start glitching if you try to use it again. Making a cooldown script would help, but I do not know how to write one. How do I add to this script to include a 3 second cooldown when a player jumps out of the seat?
workspace.Chair.Primary.ClickDetector.MouseHoverEnter:Connect(function() workspace.Chair.Primary.Transparency = 0 end) workspace.Chair.Primary.ClickDetector.MouseHoverLeave:Connect(function() workspace.Chair.Primary.Transparency = 1 workspace.Chair.Seat.Disabled = true end) workspace.Chair.Primary.ClickDetector.MouseClick:Connect(function() if workspace.Chair.Primary.Transparency == 0 then workspace.Chair.Seat.Disabled = false workspace.Chair.Leaves.Union.CanCollide = false wait() game.Players.LocalPlayer.Character.UpperTorso.CFrame = CFrame.new(workspace.Chair.Seat.Position) if not game.Players.LocalPlayer.Character.UpperTorso.CFrame == CFrame.new(workspace.Chair.Seat.Position) then workspace.Chair.Leaves.Union.CanCollide = true end end end)