local function getObjectFromPath(path, root) root = root or game local currentChild = root for depth, childName in pairs(string.split(path, "/")) do currentChild = currentChild:FindFirstChild(childName) if not currentChild then break end end return currentChild end
Takes paths in the format "Workspace/SomeFolder/SomeModel/SomePart" and tries to go down the hierarchy, starting at root (game by default). I don't think this is as elegant as it could be. Any suggestions?