How to use GetVelocity() to make an impulse in the direction of the player

Below is my current code. It works when the section labeled "thrust in current direction" is removed. Any ideas why this section is preventing the above code from working? Can I get some help with the syntax of if / and statements?
--------------------------------------------------------------------------------------------------------------Header
local iT = script:GetCustomProperty("InitialThrust") --Modifyer on initial impulse to movement
local cT = script:GetCustomProperty("ContinuedThrust") --Modifyer on acceleration growth
local tP = script:GetCustomProperty("ThrustPower") --Modifyer on gravatational pull
local jetTimes = 0 --Time the Jetpack is running
local jetOn = false --Jetpack trigger
local jetBurst = iT / 100
local jetCarry = cT / 100
local jetPower = tP / 100
local targetPlayer = nil
--------------------------------------------------------------------------------------------------------------Standing Lift
function OnBindingPressed(whichPlayer, binding)
if (binding == "ability_extra_20") then
targetPlayer = whichPlayer
targetPlayer.gravityScale = -1 * jetPower
targetPlayer:AddImpulse(Vector3.UP * jetBurst)
jetOn = true
end
end
function Tick(deltaTime)
while jetOn == true do
jetCarry = jetCarry * jetTimes
targetPlayer:AddImpulse(Vector3.UP * targetPlayer.mass * jetCarry)
jetTimes = jetTimes + 0.5
Task.Wait(2.5)
end
end
--------------------------------------------------------------------------------------------------------------thrust in current direction
function OnBindingPressed(whichPlayer, binding)
if (binding == "ability_extra_20")
and (whichPlayer.isWalking == true) then
targetPlayer = whichPlayer
targetPlayer.gravityScale = 0.9
targetPlayer:AddImpulse(targetPlayer:GetVelocity() * jetBurst)
end
end
--------------------------------------------------------------------------------------------------------------Return
function OnBindingReleased(whichPlayer, binding)
if (binding == "ability_extra_20") then
whichPlayer.gravityScale = 1.5
jetOn = false
jetTimes = 0
end
end

--------------------------------------------------------------------------------------------------------------Footer

function OnPlayerJoined(player)
player.bindingPressedEvent:Connect(OnBindingPressed)
player.bindingReleasedEvent:Connect(OnBindingReleased)
end

Game.playerJoinedEvent:Connect(OnPlayerJoined)

The two OnBindingPressed functions seem to be conflicting and only one runs.
I moved the second one inside the first (see below) and it worked.

function OnBindingPressed(whichPlayer, binding)

if (binding == "ability_extra_20") then
targetPlayer = whichPlayer
targetPlayer.gravityScale = -1 * jetPower
targetPlayer:AddImpulse(Vector3.UP * jetBurst)
jetOn = true
if whichPlayer.isWalking == true then
targetPlayer = whichPlayer
targetPlayer.gravityScale = 0.9
targetPlayer:AddImpulse(targetPlayer:GetVelocity() * jetBurst)
end
end
end

What do you mean by:

If you don't remove the code are you receiving an error?

Thanks Utterly. I have never worked with a code that allows an "if" statement within an "if" statement. This does make the code operable, but is not quite what I was looking for. I want an ability key to do one thing while standing still, and another if pressed while walking.

I want the code to operate a jetpack that thrusts upward if standing still, but thrusts the player in the direction of his movement (like roller skates) if the player is in the process of walking. Any ideas how to accomplish that with the example code?

the two if stmts in parallel rather than nested should work. I put the if/and one first as it is logically tidier

function OnBindingPressed(whichPlayer, binding)
if (binding == "ability_extra_20") and
(whichPlayer.isWalking == true) then
targetPlayer = whichPlayer
targetPlayer.gravityScale = 0.9
targetPlayer:AddImpulse(targetPlayer:GetVelocity() * jetBurst)
end
if (binding == "ability_extra_20") then
targetPlayer = whichPlayer
targetPlayer.gravityScale = -1 * jetPower
targetPlayer:AddImpulse(Vector3.UP * jetBurst)
jetOn = true
end

Without knowing enough about your code, maybe this is what you really want?

function OnBindingPressed(whichPlayer, binding)
    if (binding == "ability_extra_20") and (whichPlayer.isWalking == true) then
        targetPlayer = whichPlayer
        targetPlayer.gravityScale = 0.9
        targetPlayer:AddImpulse(targetPlayer:GetVelocity() * jetBurst)
else if (binding == "ability_extra_20") then
    targetPlayer = whichPlayer
    targetPlayer.gravityScale = -1 * jetPower
    targetPlayer:AddImpulse(Vector3.UP * jetBurst)
    jetOn = true
end