Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. hits = 0
  2. ------------------------------
  3. local MiningSound = script.Parent.MiningSound
  4. local MinedSound = script.Parent.MinedSound
  5. ------------------------------
  6. function reset()
  7. hitsneeded = 0
  8. hits = 0
  9. end
  10. ---------------------------------------
  11. script.Parent.Handled.Touched:connect(function(basePart)
  12. if (basePart.Name == "IronOre") then
  13. local player = game.Players:FindFirstChild(script.Parent.Parent.Name)
  14. local ironore = game.ReplicatedStorage.UnrefinedIronOre:Clone()
  15.  
  16. if (player) then
  17. hitsneeded = game.Workspace.basePart.hitsneeded.Value
  18. hits = hits+1
  19. MiningSound:Play()
  20.  
  21. if hits >= hitsneeded then
  22. ironore.Parent = player.Backpack
  23. MineSound:Play()
  24. wait(1)
  25. basePart.Transparency = 0
  26. basePart.CanCollide = false
  27. wait(10)
  28. reset()
  29. basePart.Transparency = 1
  30. basePart.CanCollide = true
  31. end
  32. -----------------------------------------------------------
  33. if (basePart.Name == "GoldOre") then
  34. local player = game.Players:FindFirstChild(script.Parent.Parent.Name)
  35. local goldore = game.ReplicatedStorage.UnrefinedGoldOre:Clone()
  36.  
  37. if (player) then
  38. hitsneeded = game.Workspace.basePart.hitsneeded.Value
  39. hits = hits+1
  40. MiningSound:Play()
  41.  
  42. if hits >= hitsneeded then
  43. goldore.Parent = player.Backpack
  44. MineSound:Play()
  45. wait(1)
  46. basePart.Transparency = 0
  47. basePart.CanCollide = false
  48. wait(10)
  49. reset()
  50. basePart.Transparency = 1
  51. basePart.CanCollide = true
  52. end
  53. end
  54. end
  55. return (nil);
  56.  
  57. end
  58. end
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement