How to disable player movement without walkspeed

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!
    i currently want to push the player forward automatically without the character being able to move, simple enough
  2. What is the issue? Include screenshots / videos if possible!
    i tried using context action service, but if you’re holding a control key while the controls get re-enabled then it doesn’t move the player
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i’ve tried looking for solutions on the devhub, but nothing has worked

You could anchor the HumanoidRootPart. If you want to move the player after that, just move the HumanoidRootPart as desired.

1 Like

Anchor the primary part of the player

if i anchor the HRP while he’s midair he’d be stuck freefalling

Then simply wait until the player is on the ground. Example:

function freezePlayer(plr)
    if plr.Character then
        local char = plr.Character
        local hum = char.Humanoid

        if hum:GetState() == Enum.HumanoidStateType.FreeFall then
            repeat
                local old,new = hum.StateChanged:Wait()
            until new == Enum.HumanoidStateType.Landed
        end

        char.HumanoidRootPart.Anchored = true
    end
end

all my anims get bugged out when i try this, any other solution other than anchoring hrp

You could try to get the player humanoid to then use plrHumanoidHere:MoveTo(obj.Position)
https://developer.roblox.com/en-us/api-reference/function/Humanoid/MoveTo
To prevent the player from moving, you can try disabling the player’s keybind. I created a script that did this some time ago, unfortunately I couldn’t find it so I’ll link to a forum post that looks like what I did at the time.

plr.DevComputerMovementMode = Enum.DevComputerMovementMode.Scriptable

and not script it there’s also DevTouchMovementMode for mobile

2 Likes

I never tried it but from what the docs say, it should also work and it look like a better alternative than mine.

https://developer.roblox.com/en-us/api-reference/enum/DevComputerMovementMode

Screen Shot 2022-07-06 at 4.25.08 PM

I think it needs to be from a server script

like i said in the post, i’ve tried using contextactionservice but if im holding the W key before i regain control of the player, then when i DO gain back control he still won’t move till i let go of the key then hold it down again if that makes any sense

now it just won’t return anything at all, no errors or anything

idk why I checked and it does become scriptable maybe try testing in roblox

it might be cause im not using default controls, forgot to clarify that im using a custom 2d movement script. still default humanoids tho

Then the problem may be in this script, if the script handle or have any effect with the way the player move or how the inputs are used it may be the source of your problem

This will help