Place hierarchy

Place hierarchy refers to the way that objects are contained within other objects, as shown in the Explorer window found in Roblox Studio. For example:

  • Tree-collapse.png
    Workspace
    Workspace
    • Camera
      Camera
    • Part
      Part
  • Lighting
    Lighting
  • Players
    Players

Traversing[edit]

There are various ways to access the hierarchy. The trunk is always "game".

A shortcut, "workspace", refers to game.Workspace.

You can access a child by:

parent.child
parent["child"]
parent:FindFirstChild("child")

In that last case, it is not an error if child does not exist.

You can traverse multiple level and mix them freely - the hierarchy below labels ways to access parts

  • Tree-collapse.png
    Workspace
    Workspace - game.Workspace
    • Part
      Base - game.Workspace.Base
    • Tree-collapse.png
      Model
      Model - game.Workspace.Model or game.Workspace["Model"]
      • Part
        Part - game.Workspace.Model.Part or game.Workspace.Model:FindFirstChild("Part")
      • Part
        Part - not directly addressable
    • Tree-collapse.png
      Model
      Player - game.Workspace.Player
      • Part
        Head - game.Workspace.Player.Head or game["Workspace"]:FindFirstChild("Player").Head
      • Part
        Torso - game.Workspace.Player.Torso
      • Humanoid
        Humanoid - game.Workspace.Player.Humanoid
  • Tree-collapse.png
    Players
    Players - game.Players
    • Tree-collapse.png
      Player
      Player - game.Players:FindFirstChild("Player") -- always a good idea
      • PlayerGui
        PlayerGui
      • Backpack
        Backpack
      • StarterGear
        StarterGear
  • StarterGui
    StarterGui
  • StarterPack
    StarterPack
  • Lighting
    Lighting - game.Lighting

We can also move back up the tree if we start in the middle by way of variables.

b = game.Workspace.Base
part = game.Workspace.Model.Part
p = game.Players.Player
gui = game.Players.Player.PlayerGui
gui.Parent -- same as game.Players.Player
gui.Parent.Parent  --same as p.Parent or game.Players
gui.Parent.Parent.Parent -- same as game
 
part.Parent.Parent.Base -- same as b

Complete hierarchy example[edit]

(note: this hierarchy does not include StatsItems and children of the CoreGui)

  • Tree-collapse.png
    DataModel
    Place1
    • Tree-collapse.png
      Workspace
      Workspace
      • Camera
        Camera
      • Message
        Message
      • Terrain
        Terrain
    • Tree-collapse.png
      ScriptContext
      Script Context
      • StarterScript
        StarterScript
      • StarterScript
        StarterScript
      • CoreScript
        Sections
    • Expand.png
      Stats
      Stats
    • ContentProvider
      ContentProvider
    • RunService
      Run Service
    • Expand.png
      Object blank Icon.png
      GuiRoot
    • Object blank Icon.png
      GuiRoot
    • ContentFilter
      ContentFilter
    • KeyframeSequenceProvider
      Instance
    • GuiService
      GuiService
    • Chat
      Chat
    • LocalBackpack
      LocalBackpack
    • StarterPack
      StarterPack
    • StarterGui
      StarterGui
    • Expand.png
      CoreGui
      CoreGui
    • Expand.png
      SoundService
      Soundscape
    • JointsService
      JointsService
    • CollectionService
      CollectionService
    • PhysicsService
      PhysicsService
    • BadgeService
      BadgeService
    • Geometry
      Geometry
    • FriendService
      FriendService
    • RenderHooksService
      RenderHooksService
    • InsertService
      InsertService
    • SocialService
      SocialService
    • Debris
      Debris
    • TimerService
      Instance
    • ScriptInformationProvider
      Instance
    • CookiesService
      CookiesService
    • TeleportService
      Teleport Service
    • PersonalServerService
      Instance
    • Players
      Players
    • Object blank Icon.png
      FilteredSelection
    • Selection
      Selection
    • Object blank Icon.png
      FilteredSelection
    • MeshContentProvider
      MeshContentProvider
    • TextureContentProvider
      TextureContentProvider
    • Lighting
      Lighting
    • TextService
      TextService
    • Tree-collapse.png
      ControllerService
      Instance
      • HumanoidController
        Instance
    • Visit
      Visit
    • ChangeHistoryService
      ChangeHistoryService