*My friend* needs help with "how to disable character movement and character rotation when the player is jumping"

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    My friend needs help with " * how to disable character movement and character rotation when the player is jumping", I don’t know his scripting status but he seems fairly new.
  2. What is the issue? Include screenshots / videos if possible!
    He asks " * how to disable character movement and character rotation when the player is jumping"
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    He’s tried “DisableAutoRotation” or something called like that.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    When he enables “DisableAutoRotation” on the StarterCharacter the character doesn’t rotate but halfway through the jump, the character starts rotating again. “huge thanx :+1:” -RafaelPro3728dos
1 Like

This is not possible in the humanoid controller without manually adjusting CFrame to account for Shift Lock. The new physics controller has the functionality here:

This is totally possible.

The reason your friend’s code doesn’t work is probably because they used the events incorrectly so the code thinks the jump ended when the Humanoid switched to the FreeFalling state. I can’t say for sure though without seeing the code.

Here is some example code I tested that would go in a LocalScript in StarterCharacterScripts:

local character = script.Parent

local humanoid = character:WaitForChild("Humanoid")

local jumping = false
local oldWalkSpeed = humanoid.WalkSpeed
local function onJumpStart()
	jumping = true
	humanoid.AutoRotate = false
	oldWalkSpeed = humanoid.WalkSpeed 
	humanoid.WalkSpeed = 0
end

local function onJumpEnd()
	if not jumping then
		return
	end
	
	jumping = false
	humanoid.AutoRotate = true
	humanoid.WalkSpeed = oldWalkSpeed
end

humanoid.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Jumping then
		onJumpStart()
	elseif newState ~= Enum.HumanoidStateType.Freefall then
		onJumpEnd()
	end
end)

If you also want the character to not be able to rotate and move while falling (like when the character walks off a ledge), you’ll need to switch the code to using the event humanoid:GetPropertyChanged("FloorMaterial") and when the material is air the character is falling and/or jumping.

This also probably goes in #help-and-feedback:scripting-support.