Having issue with creating color changing floor tiles. The exact error reads: Workspace.colorChangingBricks.DanceFloor.color1tiles.colorChange:43: attempt to index nil with ‘Play’. I’m new to using tween functions.
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")
function ColorChange(colorToChangeTo)
local tweenInformation = TweenInfo.new(1)
local ColorProperty = {}
ColorProperty.Color = colorToChangeTo
for i,v in pairs(floorTiles) do
local tween =
tweenService:Create(v, tweenInformation, ColorProperty)
end
tween:Play()
wait(changeFrequency)
end
while true do
for i, v in ipairs(colors) do
ColorChange(v)
end
end