1. function PositionToCoords(Position) -- Converts Vector3 to in-game coordinates
  2. Position = Vector3.new(p.X/3,p.Y/3,p.Z/3)
  3. Position = Vector3.new(math.floor(p.X),math.floor(p.Y),math.floor(p.Z))
  4. return Position
  5. end
  6. function Mine(Block) -- Instantly destroys block instance
  7. spawn(function()
  8. if Block.Name ~= "Air" and Block.Name ~= "Bedrock" then
  9. game:GetService("ReplicatedStorage").events.damageBlock:FireServer(Block, math.huge)
  10. end
  11. end)
  12. end
  13. function PlaceExact(Type,X,Y) -- Places block at exact position
  14. game:GetService("ReplicatedStorage").events.placeBlock:FireServer(Type,X,Y)
  15. end
  16. function Place(Type,X,Y) -- Places block at in-game coordinate based position
  17. local XY = PositionToCoords(Vector3.new(X,Y))
  18. PlaceExact(Type,XY.X,XY.Y)
  19. end
  20. -- Mine All
  21. for i,v in pairs(workspace.map.blocks:GetChildren()) do
  22. spawn(function()
  23. Mine(v)
  24. end)
  25. end
  26. -- Block Spam
  27. while wait() do
  28. spawn(function()
  29. local Position = game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(math.random(-100,100)/10,math.random(-100,100)/10,math.random(-100,100)/10)
  30. Place("Cobblestone",Position.X,Position.Y)
  31. end)
  32. end