I been trying to do a light flicker, but it just doesn't work Ex.
function Flicker() Pointlight.enabled=true wait(0.8) Pointlight.enabled=false wait(.2) Pointlight.enabled=true wait(1) Pointlight.enabled=false wait(.2) Pointlight.enabled=true end
All names and identifiers are case sensitive. That means Enabled
and enabled
are completely different things
(Certain methods have aliases for both capitalizations, but this is almost never true of properties)
ROBLOX properties are (almost) always Capitalized, so enabled
should be Enabled
everywhere in this snippet.
You have not defined PointLight
as a variable. Probably, it can be defined in a way like this:
local PointLight = script.Parent.PointLight
It's best practice to include variable definitions as far as down as is possible (meaning in this case at the beginning of Flicker
.) If you have multiple functions using PointLight
you should define the variable above the first (first lexically speaking) function using it.
In addition, the function Flicker
is not shown to be called. You can call it with
Flicker()
or call it repeatedly with something like
while true do Flicker() end
or connect to someEvent
:
someEvent:connect( Flicker )
Try to fire the function
function Flicker() Pointlight.enabled=true wait(0.8) Pointlight.enabled=false wait(.2) Pointlight.enabled=true wait(1) Pointlight.enabled=false wait(.2) Pointlight.enabled=true end Flicker()
Thumbs up if this helps!