how would i acomplish something similar to this
i know it is made with parts and not a beam but that is about it
how would i acomplish something similar to this
i know it is made with parts and not a beam but that is about it
To accomplish this, you’d need to:
for i = 1, 15 do -- the 15 depends on the num of the cylinders that u want
local cylinder = Instance.new("Part")
cylinder.Shape = Enum.PartType.Cylinder
cylinder.Size = Vector3.new(1, 1, 1)
cylinder.Anchored = true
cylinder.CanCollide = false
cylinder.Material = Enum.Material.Neon
cylinder.BrickColor = BrickColor.new("Bright red")
cylinder.Transparency = 0.1
cylinder.Parent = workspace
table.insert(cylinders, cylinder)
end
cylinder.Size = Vector3.new(actualDistance, math.random(50,100)/100, math.random(50,100)/100)
cylinder.CFrame = CFrame.new(currentPos:Lerp(nextPos, 0.5), nextPos) * CFrame.Angles(math.rad(90), 0, math.rad(90))
after this u set the CurrentPosition to be the next one so it goes on and (i added it cuz i think there is in the vid cuz it looks like it) u add a dissolve of the cylinder, so the further it is higher is the transparency.
by doing:
cylinder.Transparency = 0.1 + (i - 1) * 0.05
As i said i made all of this for a test so its with a while true, but u can change that freely with a tool or whatever.
Imma give you all of the script i made for you so you can modify it and understand better what i’m saying.
local cylinderCount = 15
local cylinders = {}
for i = 1, cylinderCount do
local cylinder = Instance.new("Part")
cylinder.Shape = Enum.PartType.Cylinder
cylinder.Size = Vector3.new(1, 1, 1)
cylinder.Anchored = true
cylinder.CanCollide = false
cylinder.Material = Enum.Material.Neon
cylinder.BrickColor = BrickColor.new("Bright red")
cylinder.Transparency = 0.1
cylinder.Parent = workspace
table.insert(cylinders, cylinder)
end
local function createLightning(startPos, endPos)
local direction = (endPos - startPos).unit
local distance = (endPos - startPos).magnitude
local segmentLength = distance / cylinderCount
local currentPos = startPos
for i = 1, cylinderCount do
local cylinder = cylinders[i]
local randomDirection = direction + Vector3.new(math.random(-10, 10) * 0.01, math.random(-10, 10) * 0.01, math.random(-10, 10) * 0.01).unit
local nextPos = currentPos + randomDirection * segmentLength
local actualDistance = (nextPos - currentPos).magnitude
cylinder.Size = Vector3.new(actualDistance, math.random(50,100)/100, math.random(50,100)/100)
cylinder.CFrame = CFrame.new(currentPos:Lerp(nextPos, 0.5), nextPos) * CFrame.Angles(math.rad(90), 0, math.rad(90))
currentPos = nextPos
cylinder.Transparency = 0.1 + (i - 1) * 0.05
end
end
local Part = script.Parent
while true do
local startPos = Part.Position
local endPos = startPos + Part.CFrame.lookVector * math.random(40, 50) -- i randomized the end position cuz i thought it would have looked better
createLightning(startPos, endPos)
wait(0.05)
end
I hope i explained it rightly, and i hope u understood.