Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement