I’m currently wondering how is working lighting bolt system Like in game Creeper Chaos made by RVVZ
And another games that have lighting bolt system, I did not know how script is making or spawning these lighting bolts I think maybe game like Creeper Chaos is using OOP style but there is again question how ? , I tried searching forums or any youtube videos but I did not found anything , So if anyone have experience with doing lighting system, Please help me on this topic,
Thank for any help or comment you written on this post!
To make a lightning bolt, you probably need a specialized part that is cloned from ServerStorage and strikes at a random coordinate position. Haven’t made one myself so I don’t know, but this is just my theory.
EDIT:
I did a script but it just create part at once and it is changing,
But I dont know how to make it to continue to the part B
My script:
local PathService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local PartA = workspace.A
local PartB = workspace.B
local CreatedParts = {}
local LastPos = nil
while wait(2) do
local DistanceInMagnitude = (PartA.Position - PartB.Position).Magnitude
local Path = PathService:CreatePath()
Path:ComputeAsync(PartA.Position, PartB.Position)
local WayPoints = Path:GetWaypoints()
for _,point in pairs(WayPoints) do
if CreatedParts ~= {} then
for _,s in pairs(CreatedParts) do
s:Destroy()
end
end
local PermanentPos = point.Position
local ModdifiedPos = PermanentPos + Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
if LastPos == nil then
local Part = Instance.new("Part",workspace)
Part.CFrame = CFrame.new(ModdifiedPos,PartA.Position)
LastPos = Part.Position
table.insert(CreatedParts,Part)
end
local Part = Instance.new("Part",workspace)
Part.CFrame = CFrame.new(ModdifiedPos,LastPos)
LastPos = Part.Position
table.insert(CreatedParts,Part)
end
end