Greetings, I am trying to script a dancefloor. I created some parts and modeled them. I tried using a for v, _ in pairs loop and GetChildren to get every single part in the dancefloor. But I am getting the error “Attempt to index number with Color”.
Here is the script:
for v, _ in pairs(game.Workspace.DanceFloor:GetChildren()) do
while true do
for i=0,1,0.01 do
v.Color = Color3.fromHSV(i,1,1)
wait(1)
end
end
end
This is because the for loop is yielding so it will wait for the current pad to finish and then move onto the next pad.
Use this instead
local DanceFloorPads = workspace.DanceFloor:GetChildren()
while true do
for i = 0,1,0.01 do
for _,Pad in ipairs(DanceFloorPads) do
v.Color = Color3.fromHSV(i,1,1)
end
wait(1)
end
end