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

How to change light color?

I need this script to change the light's color every .1 second. Why won't it work?

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

Btw this is for a nightclub map in one of my games :D

2 answers

✓ Accepted answer

I tested it in Studio and it does work. Did you typo "Spotlight" instead of "SpotLight"? Or maybe your script's Parent doesn't contain the Spotlight object.

3 comments

0

Your right. It was a typo. Thanks!

0

For the future, in Studio you can look at the Output window and it will show you errors like this. In online mode you can press F9 to open the Developer Console, which also shows the output.

0

Wait a sec... I just realized... MERELY NOTICED ME AND ANSWERED MY QUESTION!! OMFG, I AM FREAKING OUT RIGHT NOW!

while true do
       script.Parent.SpotLight.Color = Color3.new(math.random(1,255)/255, math.random(1,255)/255, math.random(1,255)/255); 
       wait(0.1)
end

This should do it. Be warned that I renamed Spotlight to SpotLight.

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