I’m trying to make christmas lights work with tweens, but only 1 part works per function, i need to have all parts to work at the same time, i think its problem with wait()
local tween = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local all = script.Parent:GetChildren()
while true do
for i,v in pairs(all) do
if v.Name == "BlueL" then
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(9, 137, 207)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(170, 0, 170)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(196, 40, 28)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(218, 133, 65)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(0, 255, 0)}):Play()
end
end
for i,v in pairs(all) do
if v.Name == "PurpleL" then
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(170, 0, 170)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(196, 40, 28)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(218, 133, 65)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(0, 255, 0)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(9, 137, 207)}):Play()
end
end
for i,v in pairs(all) do
if v.Name == "YellowL" then
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(218, 133, 65)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(0, 255, 0)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(9, 137, 207)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(170, 0, 170)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(196, 40, 28)}):Play()
end
end
for i,v in pairs(all) do
if v.Name == "GreenL" then
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(0, 255, 0)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(9, 137, 207)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(170, 0, 170)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(196, 40, 28)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(218, 133, 65)}):Play()
end
end
for i,v in pairs(all) do
if v.Name == "RedL" then
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(196, 40, 28)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(218, 133, 65)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(0, 255, 0)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(9, 137, 207)}):Play()
wait(1)
tween:Create(v, tweeninfo, {Color = Color3.fromRGB(170, 0, 170)}):Play()
end
end
end