For example
Part = game.Workspace.Sword.Part
Can I access Part through game?
Part = Part:FindFirstChildOfClass(game) ?
I don't know
For example
Part = game.Workspace.Sword.Part
Can I access Part through game?
Part = Part:FindFirstChildOfClass(game) ?
I don't know
You can't do this on game, because it has some RobloxLocked instances. Attempting to index these will error.
You can however run the following function i made, over workspace and other instances. It will return everything inside a single table.
local function GetDescendants(o)
local AllObjects = {}
local function FindChildren(Object)
for _,v in pairs(Object:GetChildren()) do
table.insert(AllObjects,v)
FindChildren(v)
end
end
if o then
if typeof(o) == "Instance" then
FindChildren(o)
else
warn("Object is not an Instance.")
end
else
warn("No object given.")
end
if #AllObjects == 0 then
return nil
end
return AllObjects
end
local AllTheInstances = GetDescendants(workspace)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
FindFirstChild has an optional recursive search arg.