Hey deveopers, I have a pretty simple question. How would I go about making a flickering jack o’ lantern? So far all I’ve done is identify the pointlight which I’d like to flicker since I have no idea how I’d go about making this.
local Pumpkin = script.Parent
local Candle = Pumpkin:WaitForChild("Face"):WaitForChild("PointLight")
local Pumpkin = script.Parent
local Candle = Pumpkin:WaitForChild("Face"):WaitForChild("PointLight")
Candle.Enabled = false
wait(1) --Replace with the amount of time you want the light to be off.
Candle.Enabled = true
If you want it to loop, use this:
local Pumpkin = script.Parent
local Candle = Pumpkin:WaitForChild("Face"):WaitForChild("PointLight")
while true do
Candle.Enabled = false
wait(1) --Replace with the amount of time you want the light to be off.
Candle.Enabled = true
wait(10) --How often you want this code to repeat.
end
You should try and add a point light under that candle. then use math.random and whenever it choose a number, you can set the brightness. Use RunService for this m.
If you want a more random flickering pattern, this should be used. You can also use TweenService to make the transition between different brightness values smoother.