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