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

I am frustrated with lights, what am I doing wrong?

Asked by 10 years ago

It runs the script with no error but doesn't actually do anything. What should I do?

local c = game.Workspace.Part.PointLight.Color

while true do

c = Color3.new(255,0,0)

wait(0.15)

c = Color3.new(255,0,85)

wait(0.15)

c = Color3.new(255,0,170)

wait(0.15)

c = Color3.new(255,0,255)

wait(0.15)

c = Color3.new(170,0,255)

wait(0.15)

end

3 answers

Log in to vote
-2
Answered by
iLegitus 130
10 years ago

Its obivous really,Your changing the color each time,But your not dong anything with it. Try :

lc = game.Workspace.Part.PointLight

while true do
wait()

lc.Color = Color3.new(255,0,0)
wait(0.15)
lc.Color = Color3.new(255,0,85)
wait(0.15)
lc.Color = Color3.new(255,0,170)
wait(0.15)
lc.Color = Color3.new(255,0,255)
wait(0.15)
lc.Color = Color3.new(170,0,255)
wait(0.15)

end

Hope it helped :D

Ad
Log in to vote
2
Answered by 10 years ago

NEITHER answer is correct. The actual answer is that when you're creating a Color3, you don't use integers as the arguments. You use decimal values in the range of 0 - 1. I've rewritten your script to work. As you'll notice, I'm dividing each value by 255, the maximum value of a color, because doing this gives me a decimal value back, which is how to properly set a Color3. You'll also notice that for the 0's, I'm not dividing them at all. That is because it is more efficient and still just as readable, because to divide zero by 255 still gives us 0, but just writing 0 is faster for Lua to understand.

lc = game.Workspace.Part.PointLight

while true do
wait()

lc.Color = Color3.new(255 / 255, 0, 0)
wait(0.15)
lc.Color = Color3.new(255 / 255, 0,  85 / 255)
wait(0.15)
lc.Color = Color3.new(255 / 255, 0, 170 / 255)
wait(0.15)
lc.Color = Color3.new(255 / 255, 0, 255 / 255)
wait(0.15)
lc.Color = Color3.new(170 / 255, 0, 255 / 255)
wait(0.15)

end

Log in to vote
-2
Answered by
Cr0ws 20
10 years ago

game.Workspace.Part.PointLight.Color3?

Answer this question