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

FindFirstChild Hitbox not working?

local Hitboxes = {'Head', 'Torso', 'LeftUpperArm', 'RightUpperArm', 'LeftLowerLeg', 'RightLowerLeg'}


local hitbox = Hitboxes[math.random(1,#Hitboxes)]
print(hitbox) -- prints out hitbox

print(game.Players.LocalPlayer:FindFirstChild(hitbox)) -- prints out nil

1 answer

It is printing out nil because it is searching for a hitbox inside of the player, not the character. Change it to this:

local Hitboxes = {'Head', 'Torso', 'LeftUpperArm', 'RightUpperArm', 'LeftLowerLeg', 'RightLowerLeg'}


local hitbox = Hitboxes[math.random(1,#Hitboxes)]
print(hitbox) --prints out a hitbox

print(game.Players.LocalPlayer.Character:FindFirstChild(hitbox)) -- also prints out a hitbox

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