Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

JumpRequest firing multiple times?

Asked by
Dorx86 0
6 years ago
Edited 6 years ago

Not sure what is wrong with the script, JumpRequest is being fired sometimes more than once.

01CanDoubleJump = false
02LastJumpTick = tick()
03 
04game:GetService("UserInputService").JumpRequest:Connect(function()
05    if CanDoubleJump == false then
06        CanDoubleJump = true
07    elseif CanDoubleJump then
08        if tick() - LastJumpTick <= 0.5 then
09            print("DOUBLE JUMPED!")
10        end
11 
12        CanDoubleJump = false
13    end
14 
15    LastJumpTick = tick()
16end)
0
i put this into a local script in StarterCharacterScripts and it works fine doesn't print twice Nogalo 148 — 6y
0
It works only when u press spacebar in intervals, if you hold spacebar it will print multiple times. Dorx86 0 — 6y

Answer this question