Hi, trying to do some cool color effects and I'm running into some issues

The following code is supposed to change the value of a Color3Value, and it works fine for a few milliseconds and then gets slower then stops.

Here's my code:


local Red = 255
local Green = 0
local Blue = 0
	

while wait() do 
for i = 0,255,1 do
wait()
Green = i
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end

for i = 0,255,1 do
wait()
Green = i
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end


for i = 255,0,-1 do
wait()
Red = i
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end

for i = 0,255,1 do
Blue = i
wait()
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end

for i = 255,0,-1 do
wait()
Green = i
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end

for i = 0,255,1 do
wait()
Red = i
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end

for i = 255,0,-1 do
Blue = i
wait()
script.Parent.Parent.Colour.Value = Color3.new(Red/255,Green/255,Blue/255)
end
end



I'm not sure why this is happening, can someone clue me in ?

2 comments

0

Are there any loops that are very active? Wait times may be bigger if it cannot run anything at the moment at the specified time.

0

What do you mean by this?