Only 1 part work not 2

  1. What do you want to achieve? So i need 2 part with Changed Color

  2. What is the issue?


    script


for _, Neon in pairs(game.Workspace.Folder:GetChildren()) do
	if Neon:IsA("Part") and Neon.Name == "Neon" then 
	while wait() do
			Neon.Color = Color3.fromHSV(tick()%5/5,1,1)
			end
		end
end

  1. Why Work only 1 Not 2??

The problem is in the while loop. You never end it, so the rest of the parts in the table don’t get iterated through.

if you really want to make it so it updates all the time, use task.spawn

for _, Neon in pairs(game.Workspace.Folder:GetChildren()) do
	if Neon:IsA("Part") and Neon.Name == "Neon" then 
		task.spawn(function()
			while wait() do
				Neon.Color = Color3.fromHSV(tick()%5/5,1,1)
				end
			end
		end)
	end
end

or remove the while loop if you want it only to be one color

So Task.Spawn its clike Part.Changed?

task.spawn(func.) creates a new thread and will execute the function without disturbing the next code

1 Like

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