Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = Instance.new("Tool")
- tool.Name = "PixelBreaker"
- local handle = Instance.new("Part")
- handle.Name = "Handle"
- handle.Size = Vector3.new(1, 1, 1)
- handle.BrickColor = BrickColor.new("Bright red")
- handle.Anchored = false
- handle.CanCollide = true
- handle.Parent = tool
- tool.RequiresHandle = true
- tool.Grip = CFrame.new(0, 0, 0)
- tool.Parent = game.Players.LocalPlayer.Backpack
- local pixelSize = 0.5
- local numPixels = 50
- local function createPixel(position)
- local pixel = Instance.new("Part")
- pixel.Size = Vector3.new(pixelSize, pixelSize, pixelSize)
- pixel.Position = position
- pixel.Anchored = false
- pixel.CanCollide = false
- pixel.BrickColor = BrickColor.Random()
- pixel.Velocity = Vector3.new(math.random(-50, 50), math.random(50, 100), math.random(-50, 50))
- pixel.Parent = workspace
- game.Debris:AddItem(pixel, 2)
- end
- local function createFirework(position)
- for i = 1, numPixels do
- createPixel(position)
- end
- end
- tool.Activated:Connect(function()
- local mouse = game.Players.LocalPlayer:GetMouse()
- local target = mouse.Target
- if target and target:IsA("BasePart") then
- local position = target.Position
- createFirework(position)
- target:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement