Skip to content

Instantly share code, notes, and snippets.

@TheNextGuy32
Created February 22, 2021 03:17
Show Gist options
  • Save TheNextGuy32/3121bc94356745c37c8bbb7c28dd1aa1 to your computer and use it in GitHub Desktop.
Save TheNextGuy32/3121bc94356745c37c8bbb7c28dd1aa1 to your computer and use it in GitHub Desktop.
return function(path, beginWith)
if path == nil then
return nil
end
local paths ={}
local i=1
if path == nil then
return nil
end
for str in string.gmatch(path, "([^/]+)") do
path[i] = str
i = i + 1
end
local item = game.ReplicatedStorage
if beginWith ~= nil then
item = beginWith
end
for i, nextPathItem in ipairs(paths) do
item = item:WaitForChild(nextPathItem)
end
return item
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment