ContextActionService not firing on input end

I am making a jump charge ability for my game.
The main problem is that ContextActionService won’t fire on input ended.
There are no errors in the script. I’ve also tried removing all of the conditions which may stop the thing function from running like if not ran or cooldown then return end but it still won’t work.
Here is the script:

function Up(vel)
	local jump = Instance.new("BodyVelocity", hrp)
	jump.P = 1250
	jump.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	jump.Velocity = hrp.CFrame.lookVector + Vector3.new(0,37.5*vel*0.71112,0)
	game.Debris:AddItem(jump, 0.1)
end

function Jump(NAME, STATE, OBJ)
	if NAME ~= "JumpCharge" or cooldown then return end

	if STATE == Enum.UserInputState.Begin then -- only the code block under this works
		ran = true
		DoingSomething:FireServer(true)
		Track1 = humanoid.Animator:LoadAnimation(Animation)
		Track1:Play()
		humanoid.WalkSpeed = 10
		Track1.Stopped:Connect(function()
			Track2 = humanoid.Animator:LoadAnimation(Animation2)
			Track2:Play()
			Track2.Looped = true
		end)
		humanoid.WalkSpeed = 1
		humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
		timeheld = tick()
	elseif STATE == Enum.UserInputState.End then -- code block under this never works
		if not ran or cooldown then return end -- I've tried removing this part and it still wont run
		cooldown = true
		timeheld = tick() - timeheld
		print(timeheld)
		Track1:Stop()
		Track2:Stop()
		Track3 = humanoid.Animator:LoadAnimation(Animation3)
		Track3:Play()
		if timeheld < 1.125 then
			Up(1.125)
		elseif timeheld >= 1.125 and timeheld <= 3 then
			Up(timeheld)
		elseif timeheld > 3 then
			Up(3)
		end
		task.wait()
		humanoid.WalkSpeed = 16
		humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		task.wait()
		ran = false
		DoingSomething:FireServer(false)
		task.wait(cooldowntime)
		cooldown = false
	end

end

contextactionservice:BindAction("JumpCharge", Jump, false, Enum.KeyCode.F)

char:WaitForChild("DoingSomething").Changed:Connect(function()
	if char:WaitForChild("DoingSomething").Value == false then
		contextactionservice:BindAction("JumpCharge", Jump, false, Enum.KeyCode.F)
	else
		contextactionservice:UnbindAction("JumpCharge")
	end
end)

No matter what I do, the code that is supposed to run when input ends never works. It works just fine when I use UserInputService but I wanted to try using ContextActionService as it is a lot easier to disable/enable the function.

local Enumeration = Enum
local Game = game
local ContextActionService = Game:GetService("ContextActionService")

local function OnAction(Action, State, InputObject)
	if State.Name == "End" then
		print("Hello world!")
	end
end

ContextActionService:BindAction("Action", OnAction, false, Enumeration.KeyCode.F)

This is working for me.