https://gyazo.com/38924ad7bb90346602087c6252965b01
For example here, what would I use to print the entire directory of objects that the textbutton "left" is inside of?
In short, if you're only interested in displaying the path of some object then you can use obj:GetFullName()
. This returns a string of the object's hierarchy. For example:
local p = Instance.new("Part") p.Parent = workspace print(p:GetFullName()) --> "Workspace.Part"
If you want a more useful result, say for example, a table of ancestors, you'd have to write this function yourself. I assume ROBLOX will add this feature some time in the near future, though.
local function GetAncestors(obj) local parent = obj.Parent local ans = {} while (parent) do ans[#ans+1] = parent parent = parent.Parent end return ans end
Let me know if you have any questions. hope this helps.