Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local colors = {Color3.fromRGB(255, 0, 0), Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 0, 255), Color3.fromRGB(255, 255, 0), Color3.fromRGB(0, 255, 255), Color3.fromRGB(255, 0, 255), Color3.fromRGB(255, 165, 0)}
- local circles = {}
- for i = 1, 7 do
- local circle = Instance.new("Frame")
- circle.Size = UDim2.new(0, 200, 0, 200)
- circle.Position = UDim2.new(math.random(), 0, math.random(), 0)
- circle.BackgroundColor3 = colors[i]
- circle.BorderSizePixel = 0
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(1, 0)
- corner.Parent = circle
- circle.Parent = screenGui
- table.insert(circles, circle)
- end
- local function moveCircle(circle)
- local direction = Vector2.new(math.random(-1, 1), math.random(-1, 1)).unit
- local speed = math.random(10, 10)
- while true do
- local newPos = circle.Position + UDim2.new(direction.X * speed / 2000, 0, direction.Y * speed / 2000, 0)
- if newPos.X.Scale < 0 or newPos.X.Scale > 0.9 then
- direction = Vector2.new(-direction.X, direction.Y)
- end
- if newPos.Y.Scale < 0 or newPos.Y.Scale > 0.9 then
- direction = Vector2.new(direction.X, -direction.Y)
- end
- circle.Position = UDim2.new(math.clamp(newPos.X.Scale, 0, 0.9), 0, math.clamp(newPos.Y.Scale, 0, 0.9), 0)
- task.wait()
- end
- end
- local function createFireworkEffect(position)
- for i = 1, 50 do
- local particle = Instance.new("Frame")
- particle.Size = UDim2.new(0, 10, 0, 10)
- particle.Position = position
- particle.BackgroundColor3 = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
- particle.BorderSizePixel = 0
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(1, 0)
- corner.Parent = particle
- particle.Parent = screenGui
- local direction = Vector2.new(math.random(-1, 1), math.random(-1, 1)).unit
- local speed = math.random(50, 100)
- coroutine.wrap(function()
- for j = 1, 40 do
- particle.Position = particle.Position + UDim2.new(direction.X * speed / 2000, 0, direction.Y * speed / 2000, 0)
- task.wait()
- end
- particle:Destroy()
- end)()
- end
- end
- for _, circle in ipairs(circles) do
- coroutine.wrap(moveCircle)(circle)
- circle.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- createFireworkEffect(circle.Position)
- circle:Destroy()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement