How do i get all children

hey everybody :smiley:
Is there a way that I can get all children and change their properties at once?
and how would i go about doing this?

local Children = game.workspace.Model:GetChildren()

for i = 1, #Children do
   Children[i].Color = Color3.fromRGB(255, 0, 0)

Just adding on to the previous solution on this thread, here is the API reference, just thought it could be handy for you


to get children you do


to do stuff with them you do this

for i = 1, #stuff do

you must use


so script will know with what to work

1 Like

Actually instead of naming it as thing you can name it as Instance :slight_smile: Just saying btw.


yeah ik but it doesnt seem to work since im enabling beams from a script but it is inside a charactermodel do scripts run in charactermodels?

Scripts do run as long as they are a descendant of workspace too, so I don’t really know why its not working unless I can see the code.

local Children = script.Parent.ReentryFlames:GetChildren()

for i = 1, #Children do

Children[i].Enabled = true


Are you sure the property Enabled isn’t changing?

Also try using this loop, if its not working still.

local Children = script.Parent.ReentryFlames:GetChildren()

for i,v in pairs(Children) do
   v.Enabled = true

its not working however the origins of the script is in the startercharacter in starterplayer could that be why?

Oh. Yeah, I would recommend it removing from there, as they only work if they are a descendant of ServerScriptService or Workspace.

You could place it in the model too, if it meets your requirements?

place it in what model. however it already is in the startercharacter

Check where it is. If it isn’t workspace and it’s a workspace-type entity then it wont work or show up. I’m pretty sure a “beam” instance needs to be in workspace for it to work.

Likewise what @WaterJamesPlough said, Check the value. Is it active when you set it to active. Is it not when you set it to not?

What are the “children” can you show us an image or some sort of visualisation of the explorer. And the children the script is trying to access

1 Like

Do you want to get the children of children as well? If so do this:

All Decendants Script
for _, v in ipairs (script.Parent.ReentryFlames:GetDecendants()) do 
   if (v:IsA("Beam"))  then
       v.Enabled = true

The ones above arent working because there trying to set all children, not just beams.

You can’t call an instance as a function. This will error.

1 Like

Actually, why did you edit the post? It was fine when it was :GetDescendants method on the instance itself.

1 Like

Oops. I deleted more than I meant to lol. Sorry! I’ll fix it.