of     1   

Dollar500
#225806228Sunday, October 01, 2017 2:46 AM GMT

How cautious should I be when accessing things within a character? For example, if I’m trying to find out what the players head scale is from a local script, should I do this: if Player.Character then local Humanoid = Player.Character:FindFirstChild(“Humanoid”) if Humanoid then if Humanoid:FindFirstChild(“HeadScale”) then - Do stuff end end end I feel like I use findfirstchild all the time and I don’t know if I am using it when I don’t need to be...
LuaDesign
#225806426Sunday, October 01, 2017 2:50 AM GMT

Nope perfect amount. Hint if the name for the humanoid changed you can do FindFirstChildOfClass("Humanoid") and it will find the first obj with the 'Humanoid' class.
Dollar500
#225810398Sunday, October 01, 2017 4:34 AM GMT

Dang. I was hoping that I wouldn’t have to do that all the time...
Rerumu
#225810925Sunday, October 01, 2017 4:49 AM GMT

local function Within(Parent, Child) if Parent then return Parent:FindFirstChild(Child); end; end; local HeadScale = Within(Within(Player.Character, 'Humanoid'), 'HeadScale'); This is one way of doing it if you want to be compact.
Dollar500
#225811100Sunday, October 01, 2017 4:55 AM GMT

If the second Within function could not find the child, wouldn’t the Parent parameter of the first Within be nil? That would mean you are trying to find “HeadScale” inside of nil... This was still helpful. Thanks!
Dollar500
#225811121Sunday, October 01, 2017 4:56 AM GMT

Oops, just remembered that you have if parent. Sorry

    of     1