So I'm making a dance floor, and I want the colors on the dance floor to change every few seconds. I used a for loop to access all the parts inside my dance floor, and then inside the for loop I put in a while loop to constantly change the dance floor's color.
Here is the script I used:
for i,parts in pairs(script.Parent:GetChildren()) do
if parts.Name == "DanceFloorPart" then
parts.Material = "Neon"
while true do
parts.BrickColor = BrickColor.Random()
wait(3)
end
end
end
Now when I run the only one of the parts inside the dance floor change color. Any idea what I did wrong and how to make this work?
By the way, I have this script inside the dance floor, as you probably could tell
If you can help, thank you, and if not, still thank you for your time.

3 comments
Though Kirot22's answer did work, yours is better, thank you.
No problem :D, make sure to accept my answer!
And also, I'll accept it, but you forgot to add the "If parts.Name == "DanceFloorPart" then, so it included the script and gave and error, but that was an easy fix.