Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a pointlight change various colors?

Asked by
123bbz 0
10 years ago

Hi, im making a game were I need the pointlight in my brick to change colors. Not random colors, specific colors I want. (Red, orange, yellow, neon green, green, cyan, blue, magenta, purple.) I would like these to repeat forever. Not really fast though, I dont plan on my players getting seizures. Like the colors will cycle in a minute of so then the cycle repeats.

Please help me out with this!

THANKS!

~123bbz

0
What i"m going to do with the script when I get it is paste it into a brick with a pre-existing pointlight. The script will keep the range and brightness of the pointlight the same but will merely change the color of the light. ~123bbz 123bbz 0 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

I see that you need one. What are you going to do to get it? If you need help scripting ask a question. Anything other than scripting questions post on the ROBLOX forum.

0
Nice! I see that you have contributed well to my question! (SARCASM) What i"m going to do with the script when I get it is paste it into a brick with a pre-existing pointlight. The script will keep the range and brightness of the pointlight the same but will merely change the color of the light. ~123bbz 123bbz 0 — 10y
0
Okay I get that but first write us a script if you want help. soaprocks2 75 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

This may not be the most efficient, but it will do the job. It uses a for loop to "tween" the colors.

while true do
    for i=1, 60 do
        script.Parent.Color = Color3.new(1, i/60, 0)
        wait(.1)
    end
    for i=1, 60 do
        script.Parent.Color = Color3.new(1-(i/60), 1, 0)
        wait(.1)
    end
    for i=1, 60 do
        script.Parent.Color = Color3.new(0, 1, i/60)
        wait(.1)
    end
    for i=1, 60 do
        script.Parent.Color = Color3.new(0, 1-(i/60), 1)
        wait(.1)
    end
    for i=1, 60 do
        script.Parent.Color = Color3.new(i/60, 0, 1)
        wait(.1)
    end
    for i=1, 60 do
        script.Parent.Color = Color3.new(1, 0, 1-(i/60))
        wait(.1)
    end
end

Answer this question