For some reason whenever I try to jump the player won’t jump on ground.
local function DoubleJumpHandler(action, inputState, inputObj)
if action == "DoubleJumping" then
if inputState == Enum.UserInputState.Begin then
if hum:GetState() == Enum.HumanoidStateType.Freefall then
if not doubleJumped then
doubleJumped = true
local jVel = Instance.new("BodyVelocity", root)
jVel.Name = "jVel"
jVel.MaxForce = Vector3.new(0, 1e8, 0)
jVel.Velocity = char:FindFirstChild("HumanoidRootPart").CFrame.UpVector * jumpHeight
game:GetService("Debris"):AddItem(jVel, 0.03)
game:GetService("RunService").RenderStepped:Connect(function()
if hum:GetState() ~= Enum.HumanoidStateType.Freefall and doubleJumped then
doubleJumped = false;
end
end)
end
end
end
end
end
ContextActionService:BindAction("DoubleJumping", DoubleJumpHandler, false, Enum.KeyCode.Space, Enum.KeyCode.ButtonA)