How to anchor a player?

You read the topic it is easy but I can’t figure it out so I have tried this.

local Player = game.Players.LocalPlayer.Character
Player:FindFirstChild("HumanoidRootPart").Anchored = true
5 Likes

Might i suggest putting that in a serverscript?

2 Likes

It is a local script and it is in a gui

1 Like

Maybe try this?

local Player = game.Players.LocalPlayer

local Char = Player.Character or Player.CharacterAdded:Wait()
Char.Archivable = true
Char:WaitForChild("HumanoidRootPart").Anchored = true
9 Likes

ok
I will thanks for this but i will test it

2 Likes

Yes but whenever you want to anchor parts you should put them in a serverscript. maybe send a remote event to the server to anchor the character?

1 Like

Do you want to disable their movement or actually make them stay frozen floating in mid air?

2 Likes

I heard remote events are a key for hackers.

2 Likes

Stay frozing in the air but what you gave me this error
" Infinite yield possible on ‘Players.Mr_LegendarySword:WaitForChild(“HumanoidRootPart”)’"

1 Like

Oops sorry I made a mistake, try it now. I just fixed the code.

2 Likes

Can I also disable movement for the player for a set amount of time?

2 Likes

thats because if there isnt a humanoid root part then it will wait until there is one, to fix it do :WaitForChild(“Child”, 5) so after 5 seconds if there isnt one then it will continue.

Also bruh, no they arent, if a hacker wanted to he could just add a localscript to literally put him into noclip mode…

3 Likes

Can you show me what you changed and how it effected it? Thanks

2 Likes

xD, Okay thank you TornadoGuy77

2 Likes

To disable movement just do this in a local script. The following will disable movement then 10 seconds later it will enable it.

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


controls:Disable()

wait(10)

controls:Enable()
2 Likes

what does this mean?

Char.Archivable = true
3 Likes
local Player = game.Workspace.LocalPlayer
local hum = Player.Humanoid

Player.hum.Anchored = true
end

@Mr_LegendarySword Try this.

2 Likes

I was wrong, I don’t think Archivable has anything to do with this topic. Usually it is used to allow the player’s character to be cloned.

3 Likes

oh okay thank you for your work and thank you everyone

4 Likes

No, since the Player class does not inherit from BasePart. You can only anchor stuff that inherits from that, so stuff like Parts, SpawnLocation, WedgeParts, and similar.

5 Likes