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)

3 comments

0

The script turned out weird when I asked this question... don't worry though there is nothing wrong with the script I already have.

0

you give me your number so we can talk privately. that's how you solve it

0

Never gonna happen. If you have the answer you can say it in here.