PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

AutoJumpEnabled

Humanoid

bool

AutoJumpEnabled sets whether or not the Humanoid will attempt to automatically jump over an obstacle it is walking towards.

Currently, this property only works when the following conditions are true:

  • The Humanoid’s character model is the Player/Character of a Player.
  • The Player in question is using touch controls.

When a player’s character is spawned, this property is reflected from the value of the player’s AutoJumpEnabled property, which in turn is reflected from the StarterPlayer service’s StarterPlayer/AutoJumpEnabled property.


Code Samples


Auto-Jump Toggle

This code sample is meant for a TextButton. It allows the player to toggle the auto-jumping behavior while on a mobile device.

local player = game.Players.LocalPlayer
local button = script.Parent

local function update()
	-- Update button text
	if player.AutoJumpEnabled then
		button.Text = "Auto-Jump is ON"
	else
		button.Text = "Auto-Jump is OFF"
	end
	-- Reflect the property in the player's character, if they have one
	if player.Character then
		local human = player.Character:FindFirstChild("Humanoid")
		if human then
			human.AutoJumpEnabled = player.AutoJumpEnabled
		end
	end
end

local function onActivated()
	-- Toggle auto-jump
	player.AutoJumpEnabled = not player.AutoJumpEnabled
	-- Update everything else
	update()
end
button.Activated:connect(onActivated)
update()