Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a Point Light change to a random color every 1 second?

Why wont this work?

while true do
	script.Parent.PointLight.Color = script.Parent.PointLight.Color.Color3.new(math.random(),math.random(),math.random())
	wait(1)
end

2 answers

✓ Accepted answer

You were a bit close. The part of line 2 that is incorrect, is after the equal sign. You only need to put Color3.new(), not the whole hierarchy. The only time you'd do that is if you're making a pointlight equal to another pointlight (Or other Color3 Value)'s color. So, here's your fixed script:

while true do -- An alternate to this is while wait(1) do
	script.Parent.PointLight.Color = Color3.new(math.random(),math.random(),math.random()) -- Be sure hierarchy is correct.
	wait(1)
end

It because line 2 doesn't equal anything thus causing it to stop running, so this is the fixed code:

while true do	
script.Parent.Color = Color3.new(math.random(), math.random(), math.random())
wait(1)
end

if this helped accept it as answer and if you have any other problems leave a comment!

This discussion is preserved as it was. New answers, comments, and votes are closed.