Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to jump with multiple keys?

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)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.