GetChildren() problem!

Can someone please help me with my script I have a picture and the error is in the output please help me?

1 Like

The problem is all your for loops are the same name so you just have to make them have different names for it to work.

Try this script:

for i,v in pairs(game.Workspace.Tycoons:GetChildren()) do
	for i,b in pairs(v.Registers:GetChildren()) do
		local standParts = b.RegisterStandParts
		for i,c in pairs(standParts:GetChildren()) do
			if c.Claimed.Value == false then
				if notAgain2 == false then
					notAgain2 = true
					v.Claimed = true
					char = script.Parent
					pathFinder = game:GetService("PathfindingService")
					path = pathFinder:CreatePath()
					path:ComputeAsync(char.HumanoidRootPart.Position, c.Position)
					for i, wayPoint in pairs(path:GetWayPoints()) do

GetChildren doesn’t return all objects in a folder (i know kinda confusing?) but what i mean by that is let’s take for example we have Folder1 inside of it there’s three other folders and each of them has something inside than when using GetChildren on Folder1 it will only return the three folders inside of Folder1 however if you also want to get what inside the other folders you should use GetDescendants()

This script should work

for i , v in pairs(game.Workspace.Tycoons:GetChildren()) do
      for i ,v in pairs (v.Registers:GetDescendants()) do
             if v.Name == "RegisterStandParts" then
                   if v.Claimed.Value == false then
                         --do whatever you want
1 Like

give to someone a solution they are did all right

it does not do anything for some reason it can find the register parts idk why?

Can you show me the error please ?

there is no errror other wise I mabe could have solved it myslef

it stop at

if v.Name == "RegisterStandParts" then

is it because I have a loop then wait(5) and another loop? exactly the same but the second one does’nt work for some reason the standpart == nil

Then check for part is exist, it’s can fall under map and disappear in play test

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.