How to stop player completely

How do I fully stop the player from moving, like entirely freezing them, preventing them from even looking around? I tried to set the walkspeed to 0 but I was still able to move my camera, how would I approach this?

For context I want have an animation where the player presses a button on a wall, and to stop movement while doing so.

To summarize, how do I seize all control of the player’s movement until the animation ends.

Quick Question, are you playing the animation on a LocalScript or a Server Script?

if its on a LocalScript:
I Believe StarterPlayerScripts?

local Camera = workspace.CurrentCamera -- The Players Camera
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

-- Add Animation variables here then do the script below:
Character.Humanoid.WalkSpeed = 0
Camera.CameraType = Enum.CameraType.Scriptable -- You can use fix if you want (probably better)

Animation.Ended:Connect(function()
Character.Humanoid.WalkSpeed = 16
Camera.CameraType = Enum.CameraType.Custom
end)
1 Like

Player Controls, it’s a core script so you’ll have to dig around to find it but it’s there. From memory it should be something like PlayerScripts by AllYourBlox.

1 Like

For freezing movement, you could anchor the player’s HumanoidRootPart on the server. For the camera, you’d just change the CameraType to Fixed (or Scriptable if you’d like to adjust the camera at all during an animation).

2 Likes

Yes, a Local script (30 ch limit)

That worked! Thanks for the help!

Wanted to leave this here just in case you need it at a future time, for your use case the solution seems fine.

If you wanted the player to psychically move during the cutscene via a script (ie. :MoveTo or something), but have no control over there character whatsoever, you could use the following:

local ContextActionService = game:GetService("ContextActionService")
local Cam = workspace.CurrentCamera
	
task.wait(3)
ContextActionService:BindAction("Freeze", function() return Enum.ContextActionResult.Sink end, false, unpack(Enum.PlayerActions:GetEnumItems())) 
Cam.CameraType = Enum.CameraType.Scriptable 
-- player controlling itself is now disabled, however movement in itself is not.

task.wait(10)
ContextActionService:UnbindAction("Freeze")
Cam.CameraType = Enum.CameraType.Custom
-- player can control itself now.
4 Likes

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