Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Lua C get children function?

I was wondering if there was a getchildren function in Lua C

getglobal game
getfield -1 Players
getfield -1 GetChildren
getfield -1 Character
getfield -1 Humanoid
pushnumber 100
setfield -2 Walkspeed

1 comment

0

not too familiar with lua c but that probably equals "Players.GetChildren.Character ..." don't you have to actually call the getchildren function?

1 answer

In short: Yes, there is.

In slightly Longer: GetChildren() does exist in Lua C, and is used very often. For example, this script below will print all the Children of the Workspace. (it will not show any descendants of the children, though. Keep reading to find out how to do that.)

local children = workspace:GetChildren

for i, v in pairs(children) do
	print(v)
end

Pretty simple, right? Now, there's also another one, called GetDescendants(). This returns all descendants of the object it's called on, including things like the descendants of all descendants. It's kinda hard to explain to be honest. Here are some links if you need some more info on these:

GetChildren

GetDescendants

This discussion is preserved as it was. New answers, comments, and votes are closed.