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.

CanDoubleJump = false
LastJumpTick = tick()

game:GetService("UserInputService").JumpRequest:Connect(function()
    if CanDoubleJump == false then
        CanDoubleJump = true
    elseif CanDoubleJump then
        if tick() - LastJumpTick <= 0.5 then
            print("DOUBLE JUMPED!")
        end

        CanDoubleJump = false
    end

    LastJumpTick = tick()
end)
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