How to Disable Player Movement

So I came back to roblox and I see that a lot of things have been changed. Also I can’t seem to disable movement all way since roblox uses modules instead of localscripts for those stuff. any suggestions on what I should do?

18 Likes

You can make use of ContextActionService for this. Originally posted by TheGamer101:

local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"

ContextActionService:BindAction(
    FREEZE_ACTION,
    function()
        return Enum.ContextActionResult.Sink
    end,
    false,
    unpack(Enum.PlayerActions:GetEnumItems())
)

-- To unfreeze movement:

ContextActionService:UnbindAction(FREEZE_ACTION)

On a side note, in the future please read the guidelines for this category before posting, and use the search feature to see if your question has already been answered.

15 Likes

Toggling PlatformStand on the character’s humanoid will stop their animations, movement, and will prevent them from attempting to stand up, but you will have to take over to prevent them from flopping around since they will be affected by physics.

You can also disable controls by using the method exposed in the control script.

local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()
85 Likes

Do I have to loop that. because it stops player for a second and then I’m able to move again

1 Like

Thanks, I think I’ll be using that one

Also, you didn’t have to create a new thread. You could have edited the original post.
Please edit in the future if you make a mistake.
https://devforum.roblox.com/t/disable-movement/235830

Please mark a solution if this thread is solved.

1 Like

Editted my reply to fix the code. It should work now. You need to return Enum.ContextActionResult.Sink.

1 Like

Why can’t we have a permission to delete it tho?