0

How to jump with multiple keys?

Edited 9 days ago

I want to enable jumping with multiple keys, the problem is a bug occurs where the player can infinitely jump. I don't know what is causing this problem. Here is my attempt.

local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")

ContextActionService:UnbindAction("jumpAction")

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.LeftControl or  Enum.KeyCode.Space and gameProcessedEvent then
local character = game:GetService("Players").LocalPlayer.Character

if character then
if character.Humanoid.Health > 0 then
character.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end
end)


You should check before letting them jump whether they are Falling via GetState