I have a Frame that I want to change the color smoothly, I know I can accomplish this with a Tween but I wanted to see this way first.
Can someone explain why this doesn’t work?
Theme1.MouseButton1Click:Connect(function()
local t = 0.2;
while true do
task.wait()
local hue = tick() % t / t
local color = Color3.fromHSV(0.0276389, 0.780392, 1)
script.Parent.Parent.Parent.BackgroundColor3 = color
end
end)
I had changed it to RGB after I posted this and it still didn’t work.
Theme1.MouseButton1Click:Connect(function()
local t = 0.2;
while true do
task.wait()
local hue = tick() % t / t
local color = Color3.fromRGB(199, 140, 87)
script.Parent.Parent.Parent.BackgroundColor3 = color
end
end)
Here’s a little example i’ve made, you can try it.
Theme1.MouseButton1Click:Connect(function()
while true do
for i = 0,1,0.001*1 do
script.Parent.Parent.Parent.BackgroundColor3 = Color3.fromHSV(i,1,1)
task.wait()
end
end
end)
I know, but tween service isnt a good choice in loops that run continuously.
those who have low end device will suffer from lag, which can cause low player count.
Theme1.MouseButton1Click:Connect(function()
local t = 0.2;
while true do
for hue = 0,tick() % t / t,0.001*1 do
task.wait()
local color = Color3.fromHSV(hue, hue, hue)
script.Parent.Parent.Parent.BackgroundColor3 = color
end
end
end)
I don’t know what color are you trying to achieve, so I am making it a random color.
To change the speed of color changing then multiply the wait amount with 0.001