Waiting for parts in a folder to load

function changeColors(newStatus)
	task.wait(0.05)
	local color
	if newStatus == 0 then
		color = blue
	elseif newStatus == 2 then
		color = red
	else
		setMiddle()
		return
	end
	
	for key, value in color:GetChildren() do
		print(value.Name)
		if value:IsA("BasePart") then
			value.Transparency = 0
			value.CanCollide = true
		end
	end
end

something like this? and no this doesn’t work, it is inside of a local script.
What even is a legacy script

A normal script.

Now, make the function local. Once you have done this, let me know if it works.

Ok making it local seems to have worked

1 Like

Alright great! If you need anymore help just lemme know.

Also mind giving me the solution?

Why would changing it to local even do anything?

Because normal functions take longer to process, mainly because by default, they are strict.

!strict

I usually add a ChildAdded event to fix this issue, also if you have StreamingEnabled then make sure your parts are in a model with the streaming mode set to persistent so that they don’t stream out.

Srry Im kind of new, what is streaming enabled

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