Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the best way to immobilize players?

I am making a tool that takes about a second to use start to finish, and I want to make the user not be able to fall or anything while using the tool. I tried to anchor the HumanoidRootPart but I am not quite sure that this is the best approach to take. What is the best way to immobilize players?

2 answers

✓ Accepted answer

There are a variety of ways to immobilize a player's character model. I'll jot a few down.

  1. Set the Humanoid's state to PlatformStand, however this won't stop them from falling.
 humanoid:ChangeState(Enum.HumanoidStateType.PlatformStand)
  1. Though not as practical you could try welding the HumanoidRootPart to an anchored part.
local weld = Instance.new("WeldConstraint")
weld.Part0 = HumanoidRootPart
weld.Part1 = AnchoredPart
weld.Parent = HumanoidRootPart
  1. Anchoring the HumanoidRootPart tends to bug out a lot so I wouldn't suggest this but you can always try it as an alternative.

  2. Setting the humanoid's JumpPower and WalkSpeed both to 0 would stop them from jumping and walking but not stop them from falling.

Those are just some methods off the top of my head, keep in mind the client can always manipulate the humanoid and it's model via Filtered Enabled exploits.

As you described, one way to do this is to Anchor the player.

Local Script

local player = game.Players.LocalPlayer
player.Character.HumanoidRootPart.Anchored = true

Another way to do this is to make the player's Walkspeed 0, like so

local player = game.Players.LocalPlayer
player.Character.Humanoid.WalkSpeed = 0

This will work for players when they first enter the game, but what about after their WalkSpeed is returned to 16?

If you want to make sure the player can't move you'll need to add a custom (LocalScript) Control Script (you can also copy this when you join the game in a test server) to the StarterPlayerScripts, then if you set the ControlScript Parent to the Replicated Storage, like so:

local player = game.Players.LocalPlayer
player.PlayerScripts.ControlScript.Parent = game.ReplicatedStorage

they will be unable to move, and this can be reversed by doing the opposite

local player = game.Players.LocalPlayer
game.ReplicatedStorage.ControlScript.Parent = player.PlayerScripts

This has the benefit of being able to force the player to move to a location if you want them to

2 comments

0

"player.Character.Humanoid.Anchored = true" You cannot anchor the Humanoid, I assume you meant the HumanoidRootPart?

0

yep, lol copied the other line with humanoid to add this line, but forgot to edit that

This discussion is preserved as it was. New answers, comments, and votes are closed.