Advertisement
ERROR_CODE

Untitled

Nov 19th, 2024 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. local tool = Instance.new("Tool")
  2. tool.Name = "PixelBreaker"
  3.  
  4. local handle = Instance.new("Part")
  5. handle.Name = "Handle"
  6. handle.Size = Vector3.new(1, 1, 1)
  7. handle.BrickColor = BrickColor.new("Bright red")
  8. handle.Anchored = false
  9. handle.CanCollide = true
  10. handle.Parent = tool
  11.  
  12. tool.RequiresHandle = true
  13. tool.Grip = CFrame.new(0, 0, 0)
  14.  
  15. tool.Parent = game.Players.LocalPlayer.Backpack
  16.  
  17. local pixelSize = 0.5
  18. local numPixels = 50
  19.  
  20. local function createPixel(position)
  21.     local pixel = Instance.new("Part")
  22.     pixel.Size = Vector3.new(pixelSize, pixelSize, pixelSize)
  23.     pixel.Position = position
  24.     pixel.Anchored = false
  25.     pixel.CanCollide = false
  26.     pixel.BrickColor = BrickColor.Random()
  27.     pixel.Velocity = Vector3.new(math.random(-50, 50), math.random(50, 100), math.random(-50, 50))
  28.     pixel.Parent = workspace
  29.  
  30.     game.Debris:AddItem(pixel, 2)
  31. end
  32.  
  33. local function createFirework(position)
  34.     for i = 1, numPixels do
  35.         createPixel(position)
  36.     end
  37. end
  38.  
  39. tool.Activated:Connect(function()
  40.     local mouse = game.Players.LocalPlayer:GetMouse()
  41.     local target = mouse.Target
  42.     if target and target:IsA("BasePart") then
  43.         local position = target.Position
  44.         createFirework(position)
  45.         target:Destroy()
  46.     end
  47. end)
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement