Advertisement
Guest User

Mining Simulator 2 Script

a guest
May 30th, 2022
13,641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/xHeptc/Kavo-UI-Library/main/source.lua"))()
  2. local Window = Library.CreateLib("Mining Simulator 2", "DarkTheme")
  3.  
  4. local Tab = Window:NewTab("Main")
  5. local Section = Tab:NewSection("Auto Mine")
  6. Section:NewToggle("ON-OFF", ".", function(state)
  7. if state then
  8. _G.On = true -- true = on / false = off
  9. -- main scripts below --
  10. function breakblock(pos)
  11. local args = {
  12. [1] = pos
  13. }
  14. game:GetService("ReplicatedStorage").Events.MineBlock:FireServer(unpack(args))
  15. end
  16. local Mod = require(game:GetService("ReplicatedStorage").SharedModules.ChunkUtil)
  17. function getPartBelow()
  18. local Character = game.Players.LocalPlayer.Character
  19. local Foot = Character.RightFoot
  20. local RayOrigin = Foot.Position
  21. local RayDirection = Vector3.new(0, -1, 0)
  22. local Params = RaycastParams.new()
  23. Params.FilterType = Enum.RaycastFilterType.Blacklist
  24. Params.FilterDescendantsInstances = {Character}
  25. local Result = workspace:Raycast(RayOrigin, RayDirection, Params)
  26. if Result then
  27. local RayInstance = Result.Instance
  28. print("Instance hit: " .. tostring(RayInstance))
  29. return RayInstance
  30. end
  31. return nil
  32. end
  33. while _G.On do
  34. task.wait()
  35. local closest = getPartBelow()
  36. if closest ~= nil then
  37. local Pos = closest.Position
  38. local NewPos = Mod.worldToCell(Pos)
  39. task.spawn(
  40. function()
  41. breakblock(NewPos)
  42. end
  43. )
  44. end
  45. end
  46. else
  47. _G.On = off -- true = on / false = off
  48. -- main scripts below --
  49. function breakblock(pos)
  50. local args = {
  51. [1] = pos
  52. }
  53. game:GetService("ReplicatedStorage").Events.MineBlock:FireServer(unpack(args))
  54. end
  55. local Mod = require(game:GetService("ReplicatedStorage").SharedModules.ChunkUtil)
  56. function getPartBelow()
  57. local Character = game.Players.LocalPlayer.Character
  58. local Foot = Character.RightFoot
  59. local RayOrigin = Foot.Position
  60. local RayDirection = Vector3.new(0, -1, 0)
  61. local Params = RaycastParams.new()
  62. Params.FilterType = Enum.RaycastFilterType.Blacklist
  63. Params.FilterDescendantsInstances = {Character}
  64. local Result = workspace:Raycast(RayOrigin, RayDirection, Params)
  65. if Result then
  66. local RayInstance = Result.Instance
  67. print("Instance hit: " .. tostring(RayInstance))
  68. return RayInstance
  69. end
  70. return nil
  71. end
  72. while _G.On do
  73. task.wait()
  74. local closest = getPartBelow()
  75. if closest ~= nil then
  76. local Pos = closest.Position
  77. local NewPos = Mod.worldToCell(Pos)
  78. task.spawn(
  79. function()
  80. breakblock(NewPos)
  81. end
  82. )
  83. end
  84. end
  85. end
  86. end)
  87. local Section = Tab:NewSection("Chest Finder")
  88. Section:NewButton("Click", ".", function()
  89. local _speed=100 -- lower if you are getting tp'd back (shouldn't happen)
  90. function tp(...)
  91. local plr=game.Players.LocalPlayer
  92. local args={...}
  93. if typeof(args[1])=="number"and args[2]and args[3]then
  94. args=Vector3.new(args[1],args[2],args[3])
  95. elseif typeof(args[1])=="Vector3" then
  96. args=args[1]
  97. elseif typeof(args[1])=="CFrame" then
  98. args=args[1].Position
  99. end
  100. local dist=(plr.Character.HumanoidRootPart.Position-args).Magnitude
  101. game:GetService("TweenService"):Create(
  102. plr.Character.HumanoidRootPart,
  103. TweenInfo.new(dist/_speed,Enum.EasingStyle.Linear),
  104. {CFrame=CFrame.new(args)}
  105. ):Play()
  106. end
  107. for i,v in pairs(game:GetService("Workspace").Chests:GetChildren()) do
  108. if v.Name == "Legendary" then -- Change the name to "Wood", "Silver", "Gold", "Epic" or "Legendary"
  109. tp(game:GetService("Workspace").Chests.Legendary.Part.Position) -- Change The Path too to .Wood, .Silver, .Gold, .Epic or ,Legendary
  110. end
  111. end
  112. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement