What Am I Doing Wrong?

Hello everyone, I’m trying to change this point-light and part colour.

Basically I’m trying to make one of those flashing lights, it’ll change from blue to red and red to blue, and it would loop, please help.

I want the PointLight to change at the same time as the part.

while true do
	script.Parent.Color = Color3.new(0.458824, 0.705882, 0.72549) --// this is for the point light.
	script.Parent.Parent.BrickColor = BrickColor.new(0.458824, 0.705882, 0.72549) --// this is for the part colour
	wait(1)
	script.Parent.Color = Color3.new(0.635294, 0, 0) --// this is for the point light.
	script.Parent.Parent.BrickColor = BrickColor.new(0.635294, 0, 0) --// this is for the part colour
end

This is how I have my part laid out!

2021-07-24

1 Like

Try this

while true do
script.Parent.Color = Color3.new(0.458824, 0.705882, 0.72549) --// this is for the point light.
script.Parent.Parent.Color = Color3.new(0.458824, 0.705882, 0.72549) --// this is for the part colour
wait(1)
script.Parent.Color = Color3.new(0.635294, 0, 0) --// this is for the point light.
script.Parent.Parent.Color = Color3.new(0.635294, 0, 0) --// this is for the part colour
end

Always check your output if you are not entirely sure about what is going wrong in your code.

1 Like

Nothing is happening in my output, I’m going to try Lucid’s script.

1 Like

It changes to blue, but nothing happens after that. It doesn’t change back to red.

1 Like

Add a wait(1) at the bottom of the while loop as well because you are only making it turn into red for a little bit then it goes back to blue quickly so you don’t see the change.

2 Likes

Thank you so much! I was panicking :joy:

1 Like