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

AutoJumpEnabled

StarterPlayer

bool

The AutoJumpEnabled property sets whether the character will automatically jump when hitting an obstacle on a mobile device.

This property is copied from the StarterPlayer to a Player when they join the game. Following that. the value of this property is copied to Humanoid/AutoJumpEnabled property of the Player/Characters Humanoid on spawn. In other words, it is possible to set the auto-jump behavior on a per-character, per-player and per-game basis using these three properties.


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()