[SOLVED] For i,v loop doesn't work in localscript?

Yes it has 3 children.
image

I changes pairs to ipairs and it still doesn’t print anything inside the loop.

task.wait(3)
local AllMonitors = game.Workspace.GeneratedConcreteTunnels:WaitForChild("Connector").MonitorFolder
local PropMonitors = AllMonitors.PropMonitors
local PositionMonitors = AllMonitors:WaitForChild("PositionMonitors")
local WorkingMonitors = AllMonitors.WorkingMonitors
local ServerMonitorTemplate = script:WaitForChild("ExampleMonitor")
local ServerScreen = script:WaitForChild("Screen")
local ServerViewPart = script:WaitForChild("ViewPart")
print("specified all variables in "..script.Name)

for _, v in ipairs(PositionMonitors:GetDescendants()) do
	
	print("test print")

end

It only prints “specified all variables in”…script.name

It seems that waiting the extra 10 seconds fixed it! :DDDD
The loop now runs correctly, maybe it wasn’t working because the descendant file location was in a Model that was changing position and parent location while the game was loading, thanks a bunch for the help :DDD
image

No problem.

I’m glad I helped. :smiley:

1 Like

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