I have a disco floor that has 18 different bricks that need to change colors all at the same time, all the time. When I put the script as a child for each individual brick, they get out of sync with each other due to latency lag, which seems unfixable. Besides, it would be much neater and more easily accessible to put it all under one script. I tried putting all the individual floor tiles as a variable and trying to target the variable. That obviously did not work. Here's the script:
local changeFrequency = game.Workspace.colorChangingBricks.changeFrequency.Value
local floorTiles = {script.Parent.danceFloorTile1,
script.Parent.danceFloorTile2,
script.Parent.danceFloorTile3,
script.Parent.danceFloorTile4,
script.Parent.danceFloorTile5,
script.Parent.danceFloorTile6,
script.Parent.danceFloorTile7,
script.Parent.danceFloorTile8,
script.Parent.danceFloorTile9,
script.Parent.danceFloorTile10,
script.Parent.danceFloorTile11,
script.Parent.danceFloorTile12,
script.Parent.danceFloorTile13,
script.Parent.danceFloorTile14,
script.Parent.danceFloorTile15,
script.Parent.danceFloorTile16,
script.Parent.danceFloorTile18}
local colors = {BrickColor.new("Bright red").Color,
BrickColor.new("Bright yellow").Color,
BrickColor.new("Dark orange").Color,
BrickColor.new("Bright orange").Color,
BrickColor.new("Medium red").Color,
BrickColor.new("Neon orange").Color,
BrickColor.new("Daisy orange").Color}
local tweenService = game:GetService("TweenService")
local floorTiles = ("Neon")
function ColorChange(colorToChangeTo)
local tweenInformation = TweenInfo.new(1)
local ColorProperty = {}
ColorProperty.Color = colorToChangeTo
local tween =
tweenService:Create(floorTiles,tweenInformation,ColorProperty)
tween:Play()
wait(changeFrequency)
end
while true do
for i, v in ipairs(colors) do
ColorChange(v)
end
end

1 comment
Getting an error: