Heya Devs, so I’m new to scripting and I’m trying to create an effect like this where the Beams connect to the other Orbs (as seen on the image below) but I’m not sure how to do it (in a loop), could someone help me? I’ve already made the orbs, I just need help with connecting the beams with one another
This is my current code:
local number = 15
local orbs = script.DreamwalkOrbs
local radius = 7
for i=1,number do
task.wait()
local angle = (math.pi*2/number) * i -- There are 360 degrees in a circle or pi*2 radians
local x = radius * math.cos(angle) + math.random(-3,3)
local y = radius * math.sin(angle) + math.random(-3,3)
local clonedorbs = orbs:Clone()
clonedorbs.Parent = workspace
clonedorbs.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(x, math.random(1,5), y)
clonedorbs.CFrame = CFrame.new(clonedorbs.CFrame.p, char.HumanoidRootPart.CFrame.p)
clonedorbs.Beam.Attachment1 = clonedorbs.BeamConnection -- The Beam Part
end