local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local lastTapTime = 0 local clicked = false enabled = true Mouse.KeyDown:connect(function(key) if not enabled and clicked then return end if key == "s" then enabled = false local function onTap() if tick() - lastTapTime < 0.2 then print("double Click!") clicked = true local SendBack = Instance.new("BodyVelocity") local Dodge = Instance.new("Animation") Dodge.AnimationId = "http://www.roblox.com/Asset?ID=377794996" local animTrack = Player.Character.Humanoid:LoadAnimation(Dodge) animTrack:Play() SendBack.maxForce = Vector3.new(math.huge, math.huge, math.huge) SendBack.velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * -80 SendBack.Parent = Player.Character.Torso wait(.5) SendBack:Destroy() local Land = Instance.new("Animation") Land.AnimationId = "http://www.roblox.com/Asset?ID=377841975" local animTrack = Player.Character.Humanoid:LoadAnimation(Land) animTrack:Play() clicked = true end end onTap() lastTapTime = tick() wait(4) enabled = true clicked = false end end)
The debounce seems to fail if I tap the 'S' key repeatedly, there are no errors and I don't know why this happens.