Advertisement
Animescapetower

Minecraft Pickaxe

Jul 6th, 2018
2,696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.52 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2.  
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. print('Have your own minecraft pickaxe '.. game.Players.LocalPlayer.Name)
  19. mas = Instance.new("Model",game:GetService("Lighting"))
  20. Tool0 = Instance.new("Tool")
  21. Part1 = Instance.new("Part")
  22. SpecialMesh2 = Instance.new("SpecialMesh")
  23. Sound3 = Instance.new("Sound")
  24. Sound4 = Instance.new("Sound")
  25. Sound5 = Instance.new("Sound")
  26. Sound6 = Instance.new("Sound")
  27. LocalScript7 = Instance.new("LocalScript")
  28. Part8 = Instance.new("Part")
  29. ManualWeld9 = Instance.new("ManualWeld")
  30. Part10 = Instance.new("Part")
  31. LocalScript11 = Instance.new("LocalScript")
  32. ManualWeld12 = Instance.new("ManualWeld")
  33. Tool0.Name = "Pickaxe"
  34. Tool0.Parent = mas
  35. Tool0.TextureId = "rbxassetid://704114646"
  36. Tool0.GripForward = Vector3.new(-1, -0, -0)
  37. Tool0.GripPos = Vector3.new(0, 0, -1.5)
  38. Tool0.GripRight = Vector3.new(0, 1, 0)
  39. Tool0.GripUp = Vector3.new(0, 0, 1)
  40. Tool0.ToolTip = "Beware of bugs : Bugs : [May break and affect on touch not on mouse then touch] Also not the best pickaxe"
  41. Part1.Name = "Pick"
  42. Part1.Parent = Tool0
  43. Part1.BrickColor = BrickColor.new("Dark stone grey")
  44. Part1.Rotation = Vector3.new(-89.0400009, 0, 90)
  45. Part1.CanCollide = false
  46. Part1.Locked = true
  47. Part1.FormFactor = Enum.FormFactor.Plate
  48. Part1.Size = Vector3.new(1, 0.800000012, 4)
  49. Part1.CFrame = CFrame.new(-234.804764, 538.928284, -13.7873125, 5.58793545e-09, -1.00000048, 1.57160684e-09, 0.0167616773, -1.10594556e-09, 0.999860048, -0.999859869, 1.86264515e-09, 0.0167622771)
  50. Part1.BottomSurface = Enum.SurfaceType.Smooth
  51. Part1.TopSurface = Enum.SurfaceType.Smooth
  52. Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  53. Part1.Position = Vector3.new(-234.804764, 538.928284, -13.7873125)
  54. Part1.Orientation = Vector3.new(-89.0400009, 0, 90)
  55. Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  56. SpecialMesh2.Parent = Part1
  57. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=22147051"
  58. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  59. SpecialMesh2.TextureId = "rbxassetid://704114950"
  60. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  61. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  62. Sound3.Name = "Fire"
  63. Sound3.Parent = Part1
  64. Sound3.SoundId = "rbxassetid://636316879"
  65. Sound3.Volume = 1
  66. Sound4.Name = "Hit"
  67. Sound4.Parent = Part1
  68. Sound4.SoundId = "http://www.roblox.com/Asset?ID=123252378"
  69. Sound4.Volume = 1
  70. Sound5.Name = "Reload"
  71. Sound5.Parent = Part1
  72. Sound5.SoundId = "rbxassetid://145081845"
  73. Sound5.Volume = 1
  74. Sound6.Name = "Swing"
  75. Sound6.Parent = Part1
  76. Sound6.SoundId = "http://www.roblox.com/Asset?ID=119888724"
  77. Sound6.Volume = 1
  78. LocalScript7.Name = "MacheteScript"
  79. LocalScript7.Parent = Part1
  80.  
  81. local stats = Instance.new("IntValue")
  82. stats.Name = "leaderstats"
  83. stats.Parent = Player
  84.  
  85. local money = Instance.new("StringValue")
  86. money.Name = "Cubic Coins" -- Change "Money" to anything you want to name it like "Cash"
  87. money.Value = 30 -- Change the value to how many you want when the player joins the game
  88. money.Parent = stats
  89.  
  90. local money2 = Instance.new("IntValue")
  91. money2.Name = "Destroyed Blocks" -- Change "Money" to anything you want to name it like "Cash"
  92. money2.Value = 0 -- Change the value to how many you want when the player joins the game
  93. money2.Parent = stats
  94.  
  95. local money3 = Instance.new("StringValue")
  96. money3.Name = "Time Spent" -- Change "Money" to anything you want to name it like "Cash"
  97. money3.Value = 0 -- Change the value to how many you want when the player joins the game
  98. money3.Parent = stats
  99.  
  100. while true do
  101. wait()
  102. money3.Value = money3.Value + 1
  103. end
  104.  
  105. table.insert(cors,sandbox(LocalScript7,function()
  106. ------------------------
  107. --[[UTIL Functions]]--
  108. ------------------------
  109. --Global functions used by all classes are wrapped in UTIL
  110. --deal with it.
  111. local UTIL = {}
  112.  
  113. function UTIL.Class(tableIn,template)
  114. tableIn = tableIn or {}
  115. local mt = {
  116. __metatable = UTIL.DeepCopy(template);
  117. __index = UTIL.DeepCopy(template);
  118. }
  119. return setmetatable(tableIn, mt)
  120. end
  121. function UTIL.MakeClass(...)
  122. local arg = {...}
  123. assert(#arg>0, 'ERROR: class needs 1 argument or more')
  124. local members = arg[1]
  125. for i=2,#arg,1 do
  126. if type(arg[i])=='table' then
  127. for key,val in pairs(arg[i]) do
  128. if not members[key] then
  129. members[key] = val
  130. end
  131. end
  132. end
  133. end
  134. local function New(init)
  135. return UTIL.Class(init or {},members)
  136. end
  137. local function Copy(obj, ...)
  138. local newobj = obj:New(unpack(arg))
  139. for n,v in pairs(obj) do newobj[n] = v end
  140. return newobj
  141. end
  142. members.New = New
  143. members.Copy = Copy
  144. return mt
  145. end
  146.  
  147. function UTIL.DeepCopy(orig)
  148. local orig_type = type(orig)
  149. local copy
  150. if orig_type == 'table' then
  151. copy = {}
  152. for orig_key, orig_value in next, orig, nil do
  153. copy[UTIL.DeepCopy(orig_key)] = UTIL.DeepCopy(orig_value)
  154. end
  155. setmetatable(copy, UTIL.DeepCopy(getmetatable(orig)))
  156. else -- number, string, boolean, etc
  157. copy = orig
  158. end
  159. return copy
  160. end
  161.  
  162. function UTIL.Instantiate(guiType)
  163. return function(data)
  164. local obj = Instance.new(guiType)
  165. for k, v in pairs(data) do
  166. if type(k) == 'number' then
  167. v.Parent = obj
  168. else
  169. obj[k] = v
  170. end
  171. end
  172. return obj
  173. end
  174. end
  175.  
  176. function UTIL.RetroRegister(func,...)
  177. func()
  178. for _,i in ipairs({...}) do
  179. i:connect(func)
  180. end
  181. end
  182.  
  183. -- Waits for a new character to be added if the current one is invalid
  184. -- (Ensures that you don't have the old dead character after a respawn)
  185. function UTIL.WaitForValidCharacter(player)
  186. local character = player.Character
  187. if not character or not character.Parent or not character:FindFirstChild('Humanoid') or character.Humanoid.Health <= 0 then
  188. player.CharacterAdded:wait()
  189. wait(0) --NOTE: Necessary for server scripts executing on the same event
  190. character = player.Character
  191. end
  192. return character
  193. end
  194.  
  195.  
  196. -- Returns a character ancestor and its Humanoid, or nil
  197. function UTIL.FindCharacterAncestor(subject)
  198. if subject and subject ~= Workspace then
  199. local humanoid = subject:FindFirstChild('Humanoid')
  200. if humanoid then
  201. return subject, humanoid
  202. else
  203. return UTIL.FindCharacterAncestor(subject.Parent)
  204. end
  205. end
  206. return nil
  207. end
  208.  
  209. UTIL.AssetURL = 'http://www.roblox.com/asset/?id='
  210.  
  211.  
  212. UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled
  213. do
  214. local suceeded,_ =pcall(function() game.Workspace.CurrentCamera:GetPanSpeed() end)
  215. UTIL.CanCheckPanSpeed = suceeded
  216. end
  217.  
  218.  
  219. local DebrisService = Game:GetService('Debris')
  220. local DebugPrintOffset = 0
  221. function UTIL.Dprint(...)
  222. local line = ''
  223. for _, segment in pairs({...}) do
  224. line = line .. (line and ' ' or '') .. tostring(segment)
  225. end
  226. local gui = Instance.new('ScreenGui')
  227. local label = Instance.new('TextLabel')
  228. label.Text = line
  229. label.Size = UDim2.new(0.25, 0, 0.05, 0)
  230. label.BackgroundTransparency = 0.5
  231. label.Position = UDim2.new(0, 0, 0, DebugPrintOffset)
  232. label.TextWrapped = true
  233. label.Parent = gui
  234. DebrisService:AddItem(gui, 30)
  235. gui.Parent = script.Parent
  236. DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0
  237. end
  238. --
  239. --All Welding Related Utility functions should be put here
  240. --
  241. WeldUtil = {}
  242.  
  243.  
  244. do
  245.  
  246.  
  247. function WeldUtil.WeldBetween(a, b)
  248. local weld = Instance.new("Weld")
  249. weld.Part0 = a
  250. weld.Part1 = b
  251. weld.C0 = CFrame.new()
  252. weld.C1 = b.CFrame:inverse() * a.CFrame
  253.  
  254. weld.Parent = a
  255. return weld
  256. end
  257.  
  258. function WeldUtil:PermaWeld(weld)
  259. local OriginalParent = weld.Parent
  260. weld.Changed:connect(function()
  261. Delay(0,function() weld.Parent = OriginalParent end)
  262. end)
  263. end
  264.  
  265. end
  266.  
  267. local InternalEvent =
  268. {
  269. Listeners = nil,
  270. }
  271. do
  272. UTIL.MakeClass(InternalEvent)
  273. function InternalEvent:Connect(func)
  274. if not self.Listeners then self.Listeners = {} end
  275. table.insert(self.Listeners,func)
  276. end
  277. function InternalEvent:Fire(...)
  278. if not self.Listeners then return end
  279. local args = {...}
  280. for _,i in ipairs(self.Listeners) do
  281. Spawn(function() i(unpack(args)) end)
  282. end
  283. end
  284. end
  285.  
  286. --[[Sword Part Class]]--
  287.  
  288. local SwordPart =
  289. {
  290. Damage = 5,
  291. AttackTime = 0.5,
  292. CoolDown = 0,
  293.  
  294. LastSwing = 0,
  295. LastHit = 0,
  296.  
  297. Part= nil,
  298. Owner = nil,--player object that owns this sword
  299.  
  300. OnHit = nil,
  301. OnHitHumanoid = nil,
  302. OnAttackReady = nil,
  303. OnAttack = nil,
  304.  
  305.  
  306. SwingSound = nil,
  307. HitSound = nil,
  308. SwingAnimation = nil, --animation track!
  309.  
  310. ActiveConnections = {},
  311.  
  312. }
  313. do
  314. UTIL.MakeClass(SwordPart)
  315. function SwordPart.New(npart,nowner)
  316. local init= UTIL.DeepCopy(SwordPart)
  317. init.Part= npart
  318. init.Owner = nowner
  319. table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
  320.  
  321. init.OnHit = InternalEvent.New()
  322. init.OnHitHumanoid = InternalEvent.New()
  323. init.OnAttackReady = InternalEvent.New()
  324. init.OnAttack = InternalEvent.New()
  325.  
  326. return init
  327. end
  328.  
  329. function SwordPart:SwordTouch(hit)
  330. if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
  331. self.OnHit:Fire(hit)
  332. local character,humanoid = UTIL.FindCharacterAncestor(hit)
  333. if character and character ~= self.Owner.Character then
  334. humanoid:TakeDamage(self.Damage)
  335. self.OnHitHumanoid:Fire(humanoid,hit)
  336. self.LastHit = tick()
  337. if self.HitSound then
  338. self.HitSound:Play()
  339. end
  340. end
  341.  
  342. end
  343.  
  344. function SwordPart:DoSwing()
  345. if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
  346. return
  347. end
  348.  
  349. if self.SwingAnimation then
  350. self.SwingAnimation:Play()
  351. end
  352. if self.SwingSound then
  353. self.SwingSound:Play()
  354. end
  355. self.LastSwing = tick()
  356. self.OnAttack:Fire()
  357. end
  358.  
  359. function SwordPart:Destroy()
  360. for _,i in pairs(self.ActiveConnections) do
  361. i:disconnect()
  362. end
  363. end
  364. end
  365. do
  366. local Handle = script.Parent
  367. local Tool = Handle.Parent
  368.  
  369. local Player = game.Players.LocalPlayer
  370. local Character = UTIL.WaitForValidCharacter(Player)
  371. local SwingAni = UTIL.Instantiate"Animation"
  372. {AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
  373.  
  374. local HitSound = Handle:WaitForChild('Hit')
  375. local SwingSound = Handle:WaitForChild('Swing')
  376.  
  377. local SwingAniTrack
  378.  
  379. local Sword
  380.  
  381.  
  382. Tool.Equipped:connect(function(mouse)
  383. Sword = SwordPart.New(Handle,Player)
  384. Sword.Damage = 500
  385. Sword.HitSound = HitSound
  386. Sword.SwingSound = SwingSound
  387. Character = UTIL.WaitForValidCharacter(Player)
  388. local Humanoid = Character:FindFirstChild('Humanoid')
  389.  
  390. SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
  391. Sword.SwingAnimation = SwingAniTrack
  392.  
  393. Sword.OnHitHumanoid:Connect(function(humanoid,hit)
  394. local myTorso = Character:FindFirstChild('Torso')
  395. local torso = humanoid.Parent:FindFirstChild('Torso')
  396.  
  397. local Hits = 0
  398.  
  399. if not torso or not myTorso then return end
  400.  
  401. if hit.Name == "" then
  402.  
  403. end
  404.  
  405. mouse.Button1Up:connect(function()
  406.  
  407. Hits = 0
  408. end)
  409.  
  410.  
  411. end)
  412.  
  413. mouse.Button1Down:connect(function()
  414. Sword:DoSwing()
  415. end)
  416. end)
  417. Tool.Unequipped:connect(function()
  418. Sword:Destroy()
  419. end)
  420.  
  421. end
  422.  
  423. end))
  424. Part8.Name = "Handle"
  425. Part8.Parent = Tool0
  426. Part8.BrickColor = BrickColor.new("Dark stone grey")
  427. Part8.Transparency = 1
  428. Part8.Rotation = Vector3.new(-88.2799988, -1.65999997, 92.4899979)
  429. Part8.CanCollide = false
  430. Part8.FormFactor = Enum.FormFactor.Plate
  431. Part8.Size = Vector3.new(1, 0.800000012, 0.500001192)
  432. Part8.CFrame = CFrame.new(-234.805115, 538.928284, -13.7470827, -0.0434540175, -0.998636246, -0.028957922, 0.0287435874, -0.0302229878, 0.999130487, -0.998642206, 0.0425838232, 0.030018501)
  433. Part8.BottomSurface = Enum.SurfaceType.Smooth
  434. Part8.TopSurface = Enum.SurfaceType.Smooth
  435. Part8.Color = Color3.new(0.388235, 0.372549, 0.384314)
  436. Part8.Position = Vector3.new(-234.805115, 538.928284, -13.7470827)
  437. Part8.Orientation = Vector3.new(-87.6100006, -43.9699974, 136.440002)
  438. Part8.Color = Color3.new(0.388235, 0.372549, 0.384314)
  439. ManualWeld9.Name = "Weld"
  440. ManualWeld9.Parent = Part8
  441. ManualWeld9.C0 = CFrame.new(0, 0, 0, -0.0434539989, 0.0287438929, -0.998641908, -0.998635769, -0.0302229859, 0.0425838158, -0.0289579108, 0.999129951, 0.0300182104)
  442. ManualWeld9.C1 = CFrame.new(-0.0402240753, 0.000350952148, 0.000671386719, 0, 0.0167619921, -0.999859512, -1, 0, 0, 0, 0.999859512, 0.0167619921)
  443. ManualWeld9.Part0 = Part8
  444. ManualWeld9.Part1 = Part1
  445. Part10.Name = "HitBox"
  446. Part10.Parent = Tool0
  447. Part10.BrickColor = BrickColor.new("Dark stone grey")
  448. Part10.Transparency = 1
  449. Part10.Rotation = Vector3.new(178.779999, -1.07999992, 90.1199951)
  450. Part10.CanCollide = false
  451. Part10.FormFactor = Enum.FormFactor.Plate
  452. Part10.Size = Vector3.new(1.32999969, 0.800000012, 5.77000427)
  453. Part10.CFrame = CFrame.new(-234.800262, 540.384399, -13.9235306, -0.0021009997, -0.999819875, -0.0188658666, -0.999771893, 0.00250116596, -0.0212126337, 0.0212559979, 0.0188169945, -0.999597013)
  454. Part10.BottomSurface = Enum.SurfaceType.Smooth
  455. Part10.TopSurface = Enum.SurfaceType.Smooth
  456. Part10.Color = Color3.new(0.388235, 0.372549, 0.384314)
  457. Part10.Position = Vector3.new(-234.800262, 540.384399, -13.9235306)
  458. Part10.Orientation = Vector3.new(1.22000003, -178.919998, -89.8600006)
  459. Part10.Color = Color3.new(0.388235, 0.372549, 0.384314)
  460. LocalScript11.Parent = Part10
  461. table.insert(cors,sandbox(LocalScript11,function()
  462. Player = game.Players.LocalPlayer
  463.  
  464. local stats1 = Player.leaderstats["Destroyed Blocks"]
  465. local stats2 = Player.leaderstats["Cubic Coins"]
  466. Hitted = true
  467. ButtonClick = true
  468. script.Parent.Parent.Equipped:Connect(function(mouse)
  469.  
  470. mouse.Button1Down:connect(function(key)
  471.  
  472.  
  473. if ButtonClick == true then
  474. ButtonClick = false
  475. script.Parent.Touched:Connect(function(hit)
  476.  
  477. local Hits = 0
  478.  
  479. if Hitted == true then
  480. Hitted = false
  481.  
  482. if hit.Name == "Part" or "Union" or "MeshPart" then
  483. Hits = Hits + 1 * 1.43
  484. stats2.Value = stats2.Value + Hits
  485. sizex = 0
  486. sizex = sizex * hit.Size.X
  487. hit.Size = hit.Size - Vector3.new(Hits,Hits,Hits)
  488. wait(0.002)
  489.  
  490. Hitted = true
  491.  
  492. mouse.Button1Up:Connect(function()
  493. ButtonClick = true
  494. end)
  495. if Hits > hit.Size.X then
  496. stats1.Value = stats1.Value + 1
  497. stats2.Value = stats2.Value + sizex * Hits
  498. wait(0.3)
  499. hit:Destroy()
  500.  
  501. end
  502. end
  503. end
  504.  
  505. end)
  506.  
  507. end
  508. end)
  509.  
  510. end)
  511. end))
  512. ManualWeld12.Name = "Weld"
  513. ManualWeld12.Parent = Part10
  514. ManualWeld12.C0 = CFrame.new(0, 0, 0, -0.0021009997, -0.999771893, 0.0212559979, -0.999819875, 0.00250116596, 0.0188169945, -0.0188658666, -0.0212126337, -0.999597013)
  515. ManualWeld12.C1 = CFrame.new(0.160606384, -0.00450134277, 1.45361328, 5.58793545e-09, 0.0167616755, -0.99985975, -1.00000036, -1.51339918e-09, 1.86264515e-09, 1.80443749e-09, 0.999859989, 0.016762279)
  516. ManualWeld12.Part0 = Part10
  517. ManualWeld12.Part1 = Part1
  518. for i,v in pairs(mas:GetChildren()) do
  519. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  520. pcall(function() v:MakeJoints() end)
  521. end
  522. mas:Destroy()
  523. for i,v in pairs(cors) do
  524. spawn(function()
  525. pcall(v)
  526. end)
  527. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement