Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I anchor a player completely?

Asked by
sonuka 24
5 years ago
Edited 5 years ago

I want to make a player's character completely stuck I tried anchoring the humanoidrootpart but that doesn't seem to work very well you can still move. Is there a more efficient way to do this?

0
R6 or R15? ABK2017 406 — 5y
0
r15 sonuka 24 — 5y
0
I think there’s a better way, but you could always set the walk speed to 0 and disable jump... ABK2017 406 — 5y
0
Just set the WalkSpeed to 0 User#19524 175 — 5y
View all comments (6 more)
0
i don't want to do that either because i have a sprint script .-. sonuka 24 — 5y
0
I can’t remember if it allows jumping, but you could set Platformstand to true as well ABK2017 406 — 5y
0
Platformstand is weird it makes me fall into the ground sonuka 24 — 5y
0
I assume for R15 you anchored the Upper and Lower torso already? ABK2017 406 — 5y
0
Anchoring the upper and lower torso makes my camera weird if i press space to jump ._.... sonuka 24 — 5y
0
If you anchor the upper and lower torso to remove outside influences, and then remove the player's controls, that would prevent that problem. Faeyll 22 — 5y

3 answers

Log in to vote
0
Answered by
ABK2017 406 Moderation Voter
5 years ago

If you don’t want to adjust WalkSpeed then try the Platformstand...

function Freeze(player, bool)
    local char = player.Character
    local hum = char:FindFirstChildOfClass("Humanoid")
    for i,v in pairs(char:GetChildren()) do
        if v:IsA("BasePart") then
            v.Anchored = bool
        end
    end
    hum.PlatformStand = bool
end

Freeze(game:GetService("Players").LocalPlayer, true)
wait(2)
Freeze(game:GetService("Players").LocalPlayer, false)
0
this makes my camera go weird sonuka 24 — 5y
0
Hmm, maybe forcing it to another PhysicsState? ABK2017 406 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

You could just anchor the HumanoidRootPart

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Put this in a local script in the StarterPlayerScripts

local player = script.Parent.Parent
repeat
    wait()
until game.Workspace:FindFirstChild(player.Name)
local character = game.Workspace:FindFirstChild(player.Name):GetChildren()
wait(0.1)
for i=1, #character do
    if character[i].ClassName == "Part" then
        character[i].Anchored = true
    end
end

You don't need the "wait(0.1)" on line 6, it just prevents the head from going into the torso... This works with both R6 and R15, if you need any more help friend me on Roblox

Answer this question