Can't find HumanoidRootPart

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I would like to be able to anchor the player in script.

  2. What is the issue? Include screenshots / videos if possible!
    It gives me the following error = attempt to index nil with 'Anchored'

local player = game.Players.LocalPlayer
player.Character:FindFirstChild("HumanoidRootPart").Anchored = true
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried searching around, found nothing

Change :FindFirstChild() to :WaitForChild() and make sure you wait until the player’s character is loaded first.

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

Character:WaitForChild("HumanoidRootPart").Anchored = true
2 Likes

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