I wanted to make parts infinitely smoothly change colors,but when i try it changes colors so fast that my eyes start hurting,how can i fix it so it would be slow?
local TweenService = game:GetService("TweenService")
local function yes()
for i,part in pairs(workspace.NeonRoom:GetChildren()) do
TweenService:Create(part,TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{Color = Color3.new(math.random(0,255),math.random(0,255),math.random(0,255))}):Play()
end
end
while true do
yes()
wait(5)
end
You are not waiting for the tween to finish playing in your for loop. You are just playing it and then playing another at the same time. You can fix it like this:
local TweenService = game:GetService("TweenService")
local colorTweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local random = math.random
local function yes()
for i,part in pairs(workspace.NeonRoom:GetChildren()) do
local colorTween = TweenService:Create(part, colorTweenInfo, {Color = Color3.new(random(), random(), random())})
colorTween:Play()
colorTween.Completed:Wait()
end
end
while task.wait(5) do
yes()
end
I don’t think that’ll be of any help in this case for @OP, that would mean each part is going to have to wait for the other to finish changing color before they can change color, which makes their NeonRoom lose purpose
The issue was because they were using Color3.new with values above 1 rather than Color3.fromRGB, so the code was working, just a wrong constructor was used
I do have thinked the same thing but didn’t say it, I wouln’t have done it like that but it’s look better than mine. I also think that even if it’s not what he asked, this may help him undestand a lot better how Tweening work since wait() isn’t reliable for that.