Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function WaitForChildHierarchy(start,...)
- if not start:IsA("Instance") then return end
- local currentObj = start
- for _,v in pairs{...} do
- if type(v) == "string" then
- currentObj = currentObj:WaitForChild(v)
- end
- end
- return currentObj
- end
- -- In case you have to do something stupid like for example:
- local hat = workspace:WaitForChild("GameModel"):WaitForChild("Storage"):WaitForChid("Hats"):WaitForChild("Hat1")
- -- You can just do this
- local hat = WaitForChildHierarchy(workspace,"GameModel","Storage","Hats","Hat1")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement