Script doesn't freeze the Player

This scipt doesn’t freeze the Player and idk why
it doesn’t give any errors

local LocalPlayer = game:GetService("Players").LocalPlayer
local Character = LocalPlayer.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")

HumanoidRootPart.Anchored = true
wait(10)
HumanoidRootPart.Anchored = false
1 Like

Instead of anchoring the HumanoidRootPart, just set the players WalkSpeed to 0. I don’t think that the HumanoidRootPart can actually be anchored, as it is read-only. I was wrong about this, sorry.

Also, is this a ServerScript or a LocalScript?

3 Likes

and jumppower to 0 as well as walkspeed

2 Likes

Its a LocalScript (now i have to type more)

Then the solution I gave you should work, if not, just let me know.

This script should be working, it most likely isn’t if you’ve placed it in a local script and are testing it in studio. Make sure the HumanoidRootPart exists before anchoring it.

i tryed this form here bit it wont work

Can you send the updated script, as well as where the LocalScript is placed in the explorer?

Script:

local player = game.Players.LocalPlayer
local Character = player.CharacterAdded
local Humanoid = Character.Humanoid

Humanoid.WalkSpeed = 0

and its in StarterGui
and now its giving me a error:

Humanoid is not a valid member of RBXScriptSignal  -  Client - Test:3
  Stack Begin  -  Studio
  Script 'Players.Happygamer1983.PlayerGui.Test', Line 3  -  Studio - Test:3
  Stack End  -  Studio

HumanoidRootPart can be anchored like any other part, it’s a Part instance after all, so everything applies to it.

local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
1 Like

Make the Character variable player.Character or player.CharacterAdded:Wait()

Are you sure you have no erros in your consol? Cause that Character variable there has no guarantee of it actually not instancing a nil, instead of local Character = LocalPlayer.Character, have it be
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()

My bad, I guess I was thinking of the RootPart property and not the part itself.

That script worked, thank you.

the thing is this will only prevent from jumping/walking

you can still fall so anchoring would be better

Just a headsup on his script, if you erase the platform the player is sitting on, they would fall cause they aren’t frozen in place, they are just unable to move.

I only need that prevent from jumping/walking

ok then it looks like the script is perfect then

1 Like