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

How can I make fading/flashing Beam?

Asked by 4 years ago

I am making spotlights and plan to add flashing beams like spotlight, I have no idea how to script properties of beams at all, thankyou.

0
You want the light to turn off and on repeatedly? WoTrox 345 — 4y

2 answers

Log in to vote
0
Answered by
WoTrox 345 Moderation Voter
4 years ago

This site is not a request site. If you make something, we correct it, but not make you the full script. Please watch tutorial videos first, or maybe search it on google, because I won't answer your further requests.

To make a light flash, you have to disable then re-enable it. Put this script inside the part where the SpotLight is:

local time1 = 1 --This is how long you have to wait in seconds for the light to turn off again
local time2 = 1 --This is how long you have to wait in seconds for the light to turn back on
local light = script.Parent.SpotLight --Change this to your needs

while wait(time1) do

    light.Enabled = false --Turns light off

    wait(time2)

    light.Enabled = true --Turns light on

end

To make a light fade you have to slowly turn its brightness off or on. You can use the Tween Service (smoother) or a loop (easier) for that:

Loop:

local brightness = 1 --The original brightness value, usually 1
local light = script.Parent.SpotLight

--Fading out:
repeat wait(0.1) --How fast the fading is

    light.Brightness = light.Brightness - 0.01

until light.Brightness == 0

--Fading in:
repeat wait(0.1) --How fast the fading is

    light.Brightness = light.Brightness + 0.01

until light.Brightness == brightness

TweenService:

local brightness = 1
local light = script.Parent.SpotLight
local goal = {}
local TW = game.TweenService
local tweenInfo = TweenInfo.new(1) --How fast the fading is in seconds

--Fading out:
goal.Brightness = 0
local tween = TW:Create(light, tweenInfo, goal)
tween:Play()

--Fading in:
goal.Brightness = brightness
local tween = TW:Create(light, tweenInfo, goal)
tween:Play()

Sorry for my English and let me know if I helped

0
Thankyou so much! Helped so much. :) GeoXoro_15 2 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

https://gyazo.com/e25b12d440423e9ebcaf285e5d0bacd3- I was on about the Beam but like using light is really helpful too.

Answer this question