Advertisement
ERROR_CODE

circuls

Nov 2nd, 2024 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.72 KB | None | 0 0
  1. local screenGui = Instance.new("ScreenGui")
  2. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  3.  
  4. 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)}
  5.  
  6. local circles = {}
  7.  
  8. for i = 1, 7 do
  9.     local circle = Instance.new("Frame")
  10.     circle.Size = UDim2.new(0, 200, 0, 200)
  11.     circle.Position = UDim2.new(math.random(), 0, math.random(), 0)
  12.     circle.BackgroundColor3 = colors[i]
  13.     circle.BorderSizePixel = 0
  14.  
  15.     local corner = Instance.new("UICorner")
  16.     corner.CornerRadius = UDim.new(1, 0)
  17.     corner.Parent = circle
  18.  
  19.     circle.Parent = screenGui
  20.     table.insert(circles, circle)
  21. end
  22.  
  23. local function moveCircle(circle)
  24.     local direction = Vector2.new(math.random(-1, 1), math.random(-1, 1)).unit
  25.     local speed = math.random(10, 10)
  26.     while true do
  27.         local newPos = circle.Position + UDim2.new(direction.X * speed / 2000, 0, direction.Y * speed / 2000, 0)
  28.         if newPos.X.Scale < 0 or newPos.X.Scale > 0.9 then
  29.             direction = Vector2.new(-direction.X, direction.Y)
  30.         end
  31.         if newPos.Y.Scale < 0 or newPos.Y.Scale > 0.9 then  
  32.             direction = Vector2.new(direction.X, -direction.Y)
  33.         end
  34.         circle.Position = UDim2.new(math.clamp(newPos.X.Scale, 0, 0.9), 0, math.clamp(newPos.Y.Scale, 0, 0.9), 0)
  35.         task.wait()  
  36.     end
  37. end
  38.  
  39. local function createFireworkEffect(position)
  40.     for i = 1, 50 do
  41.         local particle = Instance.new("Frame")
  42.         particle.Size = UDim2.new(0, 10, 0, 10)
  43.         particle.Position = position
  44.         particle.BackgroundColor3 = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
  45.         particle.BorderSizePixel = 0
  46.  
  47.         local corner = Instance.new("UICorner")
  48.         corner.CornerRadius = UDim.new(1, 0)  
  49.         corner.Parent = particle
  50.  
  51.         particle.Parent = screenGui
  52.  
  53.         local direction = Vector2.new(math.random(-1, 1), math.random(-1, 1)).unit
  54.         local speed = math.random(50, 100)
  55.         coroutine.wrap(function()
  56.             for j = 1, 40 do  
  57.                 particle.Position = particle.Position + UDim2.new(direction.X * speed / 2000, 0, direction.Y * speed / 2000, 0)
  58.                 task.wait()  
  59.             end
  60.             particle:Destroy()
  61.         end)()
  62.     end
  63. end
  64.  
  65. for _, circle in ipairs(circles) do
  66.     coroutine.wrap(moveCircle)(circle)
  67.     circle.InputBegan:Connect(function(input)
  68.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  69.             createFireworkEffect(circle.Position)
  70.             circle:Destroy()
  71.         end
  72.     end)
  73. end
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement