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

Why is the flickering not happening?

Asked by 1 year ago

Hello. I am making a part in which the light flickers. For some reason, it isn't working. Please answer. Here's the script:

local Light = script.Parent.PointLight
local Part = script.Parent

while true do
    Light.Brightness = 10
    Part.Material = "Neon"
    Part.BrickColor = "Cool Yellow"
    wait(5)
    Light.Brightness = 0
    Part.Material = "SmoothPlastic"
    Part.BrickColor = "Fossil"
    wait(0.3)
    Light.Brightness = 10
    Part.Material = "Neon"
    Part.BrickColor = "Cool Yellow"
    wait(3)
    Light.Brightness = 0
    Part.Material = "SmoothPlastic"
    Part.BrickColor = "Fossil"
    wait(0.3)
end

1 answer

Log in to vote
0
Answered by
NykoVania 231 Moderation Voter
1 year ago

Put wait() after the loop and to change color with a script you need to use Color3.fromRGB(0,0,0)

Example:

local Light = script.Parent.PointLight
local Part = script.Parent

while true do
    wait()
    Light.Brightness = 10
    Part.Material = "Neon"
    Part.BrickColor = Color3.fromRGB(0,0,0) -- Change the rgb to the rgb value for yellow
    wait(5)
    Light.Brightness = 0
    Part.Material = "SmoothPlastic"
    Part.BrickColor =  -- Change the rgb to the rgb value for fossil
    wait(0.3)
    Light.Brightness = 10
    Part.Material = "Neon"
    Part.BrickColor = Color3.fromRGB(0,0,0) -- Change the rgb to the rgb value for yellow
    wait(3)
    Light.Brightness = 0
    Part.Material = "SmoothPlastic"
    Part.BrickColor = Color3.fromRGB(0,0,0) -- Change the rgb to the rgb value for fossil
    wait(0.3)
end
Ad

Answer this question