Skip to content

Instantly share code, notes, and snippets.

@Sleitnick
Created March 19, 2025 06:06
Show Gist options
  • Save Sleitnick/883dea78f441443a001ddb96742c03eb to your computer and use it in GitHub Desktop.
Save Sleitnick/883dea78f441443a001ddb96742c03eb to your computer and use it in GitHub Desktop.
--!strict
local function find(parent: Instance, ...: string): Instance
local instance = parent
for i = 1, select("#", ...) do
local name = (select(i, ...))
local inst = instance:FindFirstChild(name)
if inst == nil then
error(`failed to find instance "{name}" in {instance:GetFullName()}`, 2)
end
instance = inst
end
return instance
end
return find
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment