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

How make a flashlight blink every 2second?

Asked by 4 years ago

I try this but dont work.

function blink()
    while true do
        game.StarterPack.Flashlight.LightPart.SpotLight2.Brightness = 0
        game.StarterPack.Flashlight.LightPart.SpotLight.Brightness = 0
        wait(2)
        game.StarterPack.Flashlight.LightPart.SpotLight.Brightness = 0.5
        game.StarterPack.Flashlight.LightPart.SpotLight2.Brightness = 0.5
        wait(2)
    end
end
script.Parent.Touched:Connect(blink)

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

This is actually from an old script I had for a flickering flashlight. Also, the reason it doesn't work is because thats the flashlight in the starterpack, not the player's backpack.

-- put this in the flashlight's tool

local flicker = 2

local light = script.Parent:WaitForChild("LightPart")
local s1,s2 = light:WaitForChild("Spotlight"),light:WaitForChild("Spotlight2")

while true do
    for i = 1,2 do
        s1.Enabled = not s1.Enabled
        s2.Enabled = not s2.Enabled
        wait(2)
    end
end
Ad

Answer this question