How Do I Disable Auto Jump?

In ROBLOX there is a feature where if you hold the spacebar in experiences you have some sort of bunnyhop. How do I disable it?

2 Likes
local us = game:GetService("UserInputService")
local canJump = true
local cooldown = 2

us.JumpRequest:Connect(function()
	if canJump then
		canJump = false
		game.Players.LocalPlayer.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
		task.wait(cooldown)
		canJump = true
	else
		game.Players.LocalPlayer.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	end
end)

Place LocalScript in StarterPlayerScripts.

1 Like

very late reply but apparently theres something called “characterautojump” which you can disable.

CharacterAutoJump is a property of the StarterPlayer which will dertermine whether the AutoJumpEnabled property on the player’s humanoid is enabled. If this property is enabled, when walking into pretty low objects (maybe the height of your shoe top) on a mobile device, it will automatically cause you to jump.

You can easily tick off the CharacterAutoJump property to have it disabled at all times, but you can also change it throughout the gameplay by accessing it through the player’s humanoid in a LocalScript.

Example
  • Preferably a LocalScript inside StarterCharacterScripts:
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.AutoJumpEnabled = false

Although this does not solve your bunnyhop issue, the last script I provided can temporarily stop the player from jumping after they press spacebar. There is currently no way to completely stop bunnyhopping or forcing the player to release the spacebar on all devices, but you could try it on keyboard enabled devices. I see no way to detect whether the player releases the jump button on mobile though.

LocalScript in StarterPlayerScripts
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")

local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local canJump = true

local function handleAction(ActionName, InputState, InputObject)
	if ActionName == "Spacebar_Released" and InputState == Enum.UserInputState.End then
		canJump = true
	end
end

ContextActionService:BindAction("Spacebar_Released", handleAction, false, Enum.KeyCode.Space)

UserInputService.JumpRequest:Connect(function()
	if not UserInputService.KeyboardEnabled then return end
	if not canJump then
		Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	else
		Player.Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	end
	canJump = false
end)
2 Likes

it did for me when I tried though.