Player suddenly stops moving when jumping

Can’t you just set their walkspeed to 0 when they jump and set it back to 16 when they land?

I don’t think that would even work tbh

1 Like

Whenever the player moves they are always using the walkspeed. If it is immediately set to 0 the player just freezes.

Might try that later, I highly doubt it will work, though.

1 Like

Tried your solution, it failed sadly.

rip, i guess that wasn’t the movement update function. i’d poke around in that script trying to find where it gets inputted, however if you don’t wanna spend that much time on it, it’d be easier to make a bodymover approach

1 Like

Save the humanoid Move Direction before you disable the controls and then re-apply it after.

local moveDirection = Humanoid.MoveDirection
Controls:Disable()
Humanoid.MoveDirection = moveDirection

EDIT: Replace Humanoid.MoveDirection with Humanoid:Move(), thank you @XXXTMS

4 Likes

The issue with this is that the player can still keep moving. OP wants to force players to be unable to move while in the air.

1 Like

You can’t edit the Humanoid’s MoveDirection property

1 Like

try using Controls:Disable()

Try using this method:

local Humanoid = script.Parent:WaitForChild("Humanoid")

local Player = game:GetService("Players").LocalPlayer
local PlayerScripts = Player.PlayerScripts

local PlayerModule = require(PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()

local isJumping = false


local function DisablePlayerInput()
    Controls:Disable()
end


local function EnablePlayerInput()
    Controls:Enable()
end

Humanoid.StateChanged:Connect(function(old, new)
    if new == Enum.HumanoidStateType.Jumping then
        Humanoid.AutoRotate = false
        isJumping = true
        DisablePlayerInput()
    elseif new == Enum.HumanoidStateType.Freefall then
        isJumping = false
        DisablePlayerInput()
    elseif new == Enum.HumanoidStateType.Seated or new == Enum.HumanoidStateType.Physics then
  
        isJumping = false
        DisablePlayerInput()
    elseif new == Enum.HumanoidStateType.Climbing or new == Enum.HumanoidStateType.Swimming then
        isJumping = false
        DisablePlayerInput()
    else
 
        if isJumping then

            Humanoid.AutoRotate = true
            task.wait(0.1)  
            EnablePlayerInput()
            isJumping = false
        end
    end
end)

The player needs to be able to keep moving while in the air, make sure to add Humanoid:Move() after Controls have been disabled to the character keeps moving.

It doesn’t stop the player from moving, but it also makes it possible for the player to change directions

Doesn’t work, softlocked me after jumping.

try removing task.wait that maybe is causing the problem

Editing your original script like this should work.

MoveDirection isn’t writable

image

I updated the edit a while ago.

1 Like

Use Player:Move(direction) during jump state.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.