01 | local light = script.Parent.PointLight |
02 |
03 | while true do |
04 | light.Brightness = 2 |
05 | wait(. 1 ) |
06 | light.Brightness = 2.2 |
07 | wait(. 1 ) |
08 | light.Brightness = 2.4 |
09 | wait(. 1 ) |
10 | light.Brightness = 2.6 |
11 | wait(. 1 ) |
12 | light.Brightness = 2.8 |
13 | wait(. 1 ) |
14 | light.Brightness = 3 |
15 | wait(. 1 ) |
Use tweening.
A) It'll produce smoother results
B) It can be reversed
C) Way more concise
01 | local tween_service = game:GetService( "TweenService" ) |
02 |
03 | local light = script.Parent.PointLight |
04 |
05 | local tween_info = TweenInfo.new( |
06 | 1 , -- time |
07 | Enum.EasingStyle.Linear, -- easingstyle |
08 | Enum.EasingDirection.Out, -- easingdirection |
09 | 100 , -- repeats (should probably go higher for infinite loop) |
10 | true -- the magic parameter to make it reverse |
11 | ) -- you can tweak these settings of course (see wiki links below for help) |
12 |
13 |
14 | local light_tween = tween_service:Create(light, tween_info, { Brightness = 5 } ) |
15 | light_tween:Play() |
Well you could just make a loop that changes the brightness by 0.2 each time.
01 | local light = script.Parent.PointLight |
02 |
03 | while true do |
04 | wait( 0.001 ) |
05 | local light = script.Parent.PointLight |
06 |
07 | ------------------------------------------------------------------- |
08 |
09 | local currentBrightness = light.Brightness |
10 | wait( 0.1 ) |
11 | currentBrightness = currentBrightness + 0.2 |
12 | end |
If this solved your question please accept this answer.
01 | while wait( 0.1 ) do |
02 | for i = 2 , 5 , 0.2 do |
03 | script.Parent.PointLight.Brightness = i |
04 | wait( 0.1 ) |
05 | end |
06 | for i = 5 , 2 ,- 0.2 do |
07 | script.Parent.PointLight.Brightness = i |
08 | wait( 0.1 ) |
09 | end |
10 | end |