Sorry for the bad English. I'm trying to do a dash/roll/longjump script,the dash and the roll are in the same script because they share almost the same conditions to work,and the long jump is supposed to only work if the player already rolled. The script for the long jump isn't complete,but the problem is that every time i try to use this part of the script the script

1-just doesn't load

2-appears an error

I tried using

local UIS = game:GetService("UserInputService")
local localPlayer = game.Players.LocalPlayer
local character = game.Players.LocalPlayer.Character
local humanoid = script.Parent:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = 'http://www.roblox.com/Asset?ID=3403442202'
local animTrack = humanoid:LoadAnimation(animation)
local debounce = true
local CR= false

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E and humanoid:GetState() == Enum.HumanoidStateType.Freefall and debounce  then
		animTrack:Play()
		local Root = localPlayer.character:WaitForChild("HumanoidRootPart")
		Root.Velocity = Root.Velocity + Root.CFrame.lookVector*90
		debounce = false
		repeat 
			wait() 
			animTrack:Play() animTrack.TimePosition = 0.290 
		    until humanoid:GetState()== Enum.HumanoidStateType.Landed
		     or  humanoid:GetState()== Enum.HumanoidStateType.Jumping
 		debounce = true
        animTrack:Stop()
	elseif input.KeyCode == Enum.KeyCode.E and  humanoid:GetState() == Enum.HumanoidStateType.Running and debounce
		 or input.KeyCode == Enum.KeyCode.E and  humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics and debounce then 
		debounce = false
		print "now"
		local Root = localPlayer.character:WaitForChild("HumanoidRootPart")
		Root.Velocity = Root.Velocity + Root.CFrame.lookVector*300
		CR = true
		wait(0.2)
		debounce = true
		CR = false
		UIS.InputChanged:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Space and CR then
		print("obby")
		humanoid.WalkSpeed = 50
		humanoid.JumpPower = 30
	end
end)
end
	

But when i tried using the long jump it just didn't work.

I also tried

local UIS = game:GetService("UserInputService")
local localPlayer = game.Players.LocalPlayer
local character = game.Players.LocalPlayer.Character
local humanoid = script.Parent:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = 'http://www.roblox.com/Asset?ID=3403442202'
local animTrack = humanoid:LoadAnimation(animation)
local debounce = true
local CR= false

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E and humanoid:GetState() == Enum.HumanoidStateType.Freefall and debounce  then
		animTrack:Play()
		local Root = localPlayer.character:WaitForChild("HumanoidRootPart")
		Root.Velocity = Root.Velocity + Root.CFrame.lookVector*90
		debounce = false
		repeat 
			wait() 
			animTrack:Play() animTrack.TimePosition = 0.290 
		    until humanoid:GetState()== Enum.HumanoidStateType.Landed
		     or  humanoid:GetState()== Enum.HumanoidStateType.Jumping
 		debounce = true
        animTrack:Stop()
	elseif input.KeyCode == Enum.KeyCode.E and  humanoid:GetState() == Enum.HumanoidStateType.Running and debounce
		 or input.KeyCode == Enum.KeyCode.E and  humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics and debounce then 
		debounce = false
		print "now"
		local Root = localPlayer.character:WaitForChild("HumanoidRootPart")
		Root.Velocity = Root.Velocity + Root.CFrame.lookVector*300
		CR = true
		wait(0.2)
		debounce = true
		CR = false
		function LongJump()
			local CR = false
	if CR then
		print("obby")
		humanoid.WalkSpeed = 50
		humanoid.JumpPower = 30
	end
end
end
	end)
	
UIS.JumpRequest:Connect(LongJump)		

But now it appears the error Attempt to connect failed: Passed value is not a function. I wanted to know how to fix the long jump script and also how to use the InputChanged function.