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

How to make a flickering light?

Asked by 8 years ago

i tried everything. I am making a horror map and i need a flickering light.

0
Sorry for the Moderation Message you may have received. I accidentally locked your question as Not Constructive not realising the fact you had already posted an attempt at the script. I have reset the moderation on your question. In the future, please use the Edit feature under your name in the post to edit questions and answers. M39a9am3R 3210 — 8y

5 answers

Log in to vote
2
Answered by 8 years ago

Here is an esier way then FuriousGamer's answer

Also i haven't tested it so idk if It will work

local Light = script.Parent -- Or wherever your point light is

while wait(.01) do
    wait(math.random(.1, 1)) -- if this script dosen't work try changing the math.randoms to        math.random(0,1)
        light.Enabled = false
    wait(math.random(.1, 1))
        light.Enabled = true
end

PS:Next time don't ask us to make a script for you, Post your version of the script and we'll help you from there ^^

0
Your Instance Light has the L capitalized while it doesn't under in the script. Vezious 310 — 8y
0
FormFactor is deprecated. You should no longer use this property Jumbuu 110 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

create this script

while wait() do

--By FuriousGamer_129 --Made in ~~/~~/~~

--This is a script for an infinite flickering light effect. --You need to have a part called "Light" and make sure that it has a "Pointlight" inside it. --Put this script in the Workspace

light = game.Workspace.Light.PointLight

light.Enabled = true
wait(.2)

light.Enabled = false
wait(.1)

light.Enabled = true
wait(.4)

light.Enabled = false
wait(.2)

light.Enabled = true
wait(.3)

light.Enabled = false
wait(.6)

end

--You can change the wait times.

Log in to vote
0
Answered by
Valatos 166
8 years ago

Here try this one.

local light = script.Parent -- The location of the light
while wait(math.random(1,5)) do
    light.PointLight.Enabled = true -- Change "PointLight to your lighttype"
    wait(.1)
    light.PointLight.Enabled = false -- Change "PointLight to your lighttype"
end
Log in to vote
0
Answered by
sigve10 94
8 years ago

Here is the simplest way of doing this. It even has decimal waits!

math.randomseed(tick()) --To make random actually random
light = workspace.Part.Pointlight --change this value into your light object


while wait(math.random(1,1000)/1000) --waits a random number between 0.001 and 1
    light.Enabled = not light.Enabled --Changes the light into the state that it is not currently in (true -> false, false -> true)
end
Log in to vote
-2
Answered by 8 years ago

This one is WAY more efficient and shorter than all the other scripts. It is also much more random.

while wait(math.randomseed(0,1) do
    light.PointLight.Enabled = not light.PointLight.Enabled
end

If the not light.PointLight.Enabled doesnt work then do this, if it still doesnt work then just use math.random instead of math.randomseed:


while wait(math.randomseed(0,1) do if light.PointLight.Enabled == true then light.PointLight.Enabled = false else light.PointLight.Enabled = true end end

Hope this helped, feel free to press the Accept Answer Button!

1
math.randomseed sets a seed for scripts to base their math.random function off on. https://scriptinghelpers.org/questions/17929/ M39a9am3R 3210 — 8y
0
Oh, sorry about that. Just use math.random(0,1) then LifeInDevelopment 364 — 8y

Answer this question