The green things are meant to align with the red lines, however the red lines are rotated incorrect apparently. The red lines are meant to connect c0 (the centre) to c1 (where the green dots are). The green dots are refered to as holders, and are the second to appear in the function.
f
-- Boring support functions
local rad = math.pi / 180
local deg = 180 / math.pi
function UDimToVec2(UDim)
return Vector2.new(UDim.X.Offset, UDim.Y.Offset)
end
function Vec2ToUDim(Vec2)
return UDim2.new(0, Vec2.X, 0, Vec2.Y)
end
function CreateAFrame()
local Frame = Instance.new("Frame")
Frame.Parent = ScreenGui
Frame.BorderSizePixel = 0
Frame.BackgroundColor3 = Color3.new(1, 1, 1)
Frame.BackgroundTransparency = .5
return Frame
end
local Trails = 10
local c1Magnitude = 100
local c2Magnitude = 200
function ExplodeFirework(c0)
for i = 1, Trails do
local InitialRotation = (360 / Trails) * i
local c1 = c0 + (Vector2.new(math.cos(InitialRotation) * deg, math.sin(InitialRotation) * deg).unit * c1Magnitude)
local Holder = CreateAFrame()
Holder.Rotation = InitialRotation
Holder.Position = Vec2ToUDim(c0)
local Spark = CreateAFrame()
Spark.Parent = Holder
Spark.Name = "Spark"
Spark.Position = UDim2.new()
Spark.Size = UDim2.new(0, 3, 0, (c1 - c0).magnitude)
Spark.BackgroundColor3 = Color3.new(1, 0, 0)
local Holder = CreateAFrame()
Holder.Position = Vec2ToUDim(c1)
Holder.Size = UDim2.new(0, 5, 0, 5)
Holder.Position = Vec2ToUDim(c1)
Holder.BackgroundColor3 = Color3.new(0, 1, 0)
end
end