-- Define the start and end positions of the lightning bolt
local startPoint = Vector3.new(0, 50, 0)
local endPoint = Vector3.new(0, 0, 0)
-- Create a new lightning object
local lightning = Instance.new("Lightning")
lightning.Parent = workspace
lightning.Color = ColorSequence.new(Color3.new(1, 1, 1))
lightning.Enabled = true
lightning.EndPoint = endPoint
lightning.LightningWidth = 0.2
lightning.StartPoint = startPoint
-- Animate the lightning by moving the start and end points
while true do
startPoint = Vector3.new(math.random(-50, 50), math.random(0, 100), math.random(-50, 50))
endPoint = Vector3.new(math.random(-50, 50), math.random(0, 100), math.random(-50, 50))
lightning.EndPoint = endPoint
lightning.StartPoint = startPoint
wait(0.5)
end
No, just modify the existing lighting service
Lighting is a service and is not creatable.
There are different light instances you can create in a BasePart (I like to put it in an attachment in the part for more flexibility). These options are the PointLight
, SurfaceLight
, and SpotLight
instances. You can find more about those on the Roblox Documentation.
What do you mean modify isnât it a service?
They mean change the properties of the existing lighting service. And for the reason of it being a service, you cannot create it.
Iâm pretty sure there isnât a âLightningâ instance, you might get similar effects by playing around with âbeamsâ or by resizing/texturing parts.
Using beams is really good for volumetric lighting, but getting them perfect is very difficult. When done right, they look great