Could someone tell me why this script won't work? I have it under the PointLight so I can use "Parent" and the point light is 60 brightness and 60 range but it still won't work. Here is the script. It is supposed to be a strobe light that changes colors
01 | Script.Parent.Color = LightColor |
02 | while true do |
03 | script.Parent.Enabled = true |
04 | wait(. 01 ) |
05 | script.Parent.Enabled = false |
06 | Script.Parent.Color = Color.new( 1004 ) --Really Red |
07 | wait(. 01 ) |
08 | script.Parent.Enabled = true |
09 | wait(. 01 ) |
10 | script.Parent.Enabled = false |
11 | Script.Parent.Color = Color.new( "Deep Orange" ) |
12 | wait(. 01 ) |
13 | script.Parent.Enabled = true |
14 | wait(. 01 ) |
15 | script.Parent.Enabled = false |
EDIT: This is not for a Night Club, just so you know...
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?
First of all, PointLights' colors are Color3 values. Second of all, there are a few errors in your script. Like grammar, punctuation, and capitalization... But I've created a small, simple script for you that has almost all of the colors of the rainbow, and it changes every 0.5 seconds.
Here it is:
01 | local Light = script.Parent |
02 |
03 | while true do |
04 | Light.Color = Color 3. new( 255 / 255 , 0 / 255 , 0 / 255 ) -- Red |
05 | wait( 0.5 ) |
06 | Light.Color = Color 3. new( 255 / 255 , 85 / 255 , 0 / 255 ) -- Orange |
07 | wait( 0.5 ) |
08 | Light.Color = Color 3. new( 255 / 255 , 255 / 255 , 0 / 255 ) -- Yellow |
09 | wait( 0.5 ) |
10 | Light.Color = Color 3. new( 85 / 255 , 255 / 255 , 0 / 255 ) -- Green |
11 | wait( 0.5 ) |
12 | Light.Color = Color 3. new( 0 / 255 , 0 / 255 , 255 / 255 ) -- Blue |
13 | wait( 0.5 ) |
14 | Light.Color = Color 3. new( 170 / 255 , 0 / 255 , 255 / 255 ) -- Violet |
15 | wait( 0.5 ) |
16 | end |
Hope this helped!
PointLight objects use Color3, but you are using BrickColor codes. Here is what I suggest. First of all, make a part and but this script in the part. use BrickColor.new instead of of Color.new, and put the light in the code. Here is what the code should look like.
01 | Time = 0.1 --You can change this to whatever delay you need. |
02 | Color = script.Parent.BrickColor |
03 | LightColor = Script.Parent.PointLight.Color |
04 | while true do |
05 | wait(Time) |
06 | Color = BrickColor.new( 1004 ) |
07 | LightColor = Color.Color --BrickColor has a Property called Color that will convert a BrickColor --- color to a Color3 color |
08 | wait(Time) |
09 | Color = BrickColor.new( 1017 ) |
10 | LightColor = Color.Color |
11 | wait(Time) |
12 | Color = BrickColor.new( 1009 ) |
13 | LightColor = Color.Color |
14 | wait(Time) |
15 | Color = BrickColor.new( 1020 ) |
Now this might be all you need, but there is a much simpler way to do this. This way is just as useful, but a LOT smaller.
01 | Colors = { 1004 , 1017 , 1009 , 1010 , 1015 } |
02 | --Put all the color codes you want in here. |
03 | Time = 0.1 |
04 | --This is your delay. |
05 | Color = script.Parent.BrickColor |
06 | LightColor = script.Parent.PointLight.Color |
07 | for i, #Colors do |
08 | wait(Time) |
09 | Color = BrickColor.new(Colors [ i ] ) |
10 | --Change this to Color = BrickColor.new(Colors[math.random(1, #Colors)]) for random colors. |
11 | LightColor = Color.Color |
12 | end |
The nice thing about this code is that you can add more colors later and it will still work. By the way, you can go here for a list of color codes. Hope this helps!