Advertisement
DAJDAJ

Untitled

Sep 24th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1.  
  2. local function GetAxe() --Gets your current axe thats equiped when called
  3. if game.Players.LocalPlayer.Character:FindFirstChild("Tool") then
  4. return game.Players.LocalPlayer.Character.Tool --returns the axe when found
  5. else
  6. return false --returns false when not equiped
  7. end
  8. end
  9.  
  10. local function GetDamage(Axe, TreeClass)-- Gets the right Damage of the axe and returns it if called to prevent killing yourself like gold axe
  11. if Axe.ToolTip == "Basic Hatchet" then return 0.2
  12. elseif Axe.ToolTip == "Plain Axe" then return 0.55
  13. elseif Axe.ToolTip == "Steel Axe" then return 0.93
  14. elseif Axe.ToolTip == "Hardened Axe" then return 1.45
  15. elseif Axe.ToolTip == "Silver Axe" then return 1.6
  16. elseif Axe.ToolTip == "Rukiryaxe" then return 1.68
  17. elseif Axe.ToolTip == "Beta Axe of Bosses" then return 1.45
  18. elseif Axe.ToolTip == "Alpha Axe of Testing" then return 1.5
  19. elseif Axe.ToolTip == "Fire Axe" then
  20. if TreeClass ~= "Volcano" then return 0.6 else return 6.35 end
  21. elseif Axe.ToolTip == "End Times Axe" then
  22. if TreeClass ~= "LoneCave" then return 1.58 else return 10000000 end
  23. elseif Axe.ToolTip == "Candy Cane Axe" then return 0
  24. elseif Axe.ToolTip == "Johiro" then return 1.8
  25. elseif Axe.ToolTip == "Beesaxe" then return 1.4
  26. elseif Axe.ToolTip == "CHICKEN AXE" then return 0.9
  27. elseif Axe.ToolTip == "Amber Axe" then return 3.39
  28. elseif Axe.ToolTip == "The Many Axe" then return 10.2
  29. elseif Axe.ToolTip == "Gingerbread Axe" then
  30. if TreeClass == "Walnut" then return 8.5
  31. elseif TreeClass == "Koa" then return 11 else return 1.2 end
  32. elseif Axe.ToolTip == "Bird Axe" then
  33. if TreeClass ~= "Volcano" and TreeClass ~= "CaveCrawler" then return 0.5 else return 0.4 end
  34. end
  35. end
  36.  
  37. _G.TreeList = {} --Creates a table of the trees
  38. for a,b in pairs(workspace:GetChildren()) do
  39. if b.name == "TreeRegion" then
  40. b.ChildAdded:Connect(function(NewTree)--Creates functions that Adds new trees to the list
  41. table.insert(_G.TreeList, NewTree)
  42. end)
  43. for c,d in pairs(b:GetChildren()) do-- Adds the trees when first time starting the script
  44. if d.Name == "Model" then
  45. table.insert(_G.TreeList, d)
  46. end
  47. end
  48. end
  49. end
  50.  
  51. local function CutTree(Tree) --Cuts the tree when called with the tree you want to cut
  52. if GetAxe() ~= false then --checks if you have a axe equiped
  53. Damage = GetDamage(GetAxe(), Tree.TreeClass.Value) --gets the Damage
  54. local CutArguments = {
  55. sectionId = 1,
  56. faceVector = Vector3.new(0,0,-1),
  57. height = 0.5,
  58. hitPoints = Damage,
  59. cooldown = 0,
  60. cuttingClass = "Axe",
  61. tool = GetAxe()
  62. }
  63. for i=1, 50 do
  64. game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(Tree.CutEvent, CutArguments)
  65. end
  66. end
  67. end
  68.  
  69. spawn(function() --used spawn so it wont interrupt any of the other things
  70. CutEnabled = false
  71. while wait(.5) do --Main loop to do the stuff
  72. if CutEnabled == true then --Just to make it toggleable
  73. if GetAxe() ~= false then --Checks if you have a axe equiped
  74. for a,b in pairs(_G.TreeList) do
  75. if not b:FindFirstChild("RootCut") and b:FindFirstChild("CutEvent") then --Checks if the tree is already cut
  76. distance = (game.Players.LocalPlayer.Character.Head.Position - b.WoodSection.Position).magnitude --gets the distance between player and tree
  77. if distance < 225 then --if distance lower than 225 then it will cut the tree
  78. CutTree(b) --Calls the function with the tree to cut
  79. end
  80. else
  81. table.remove(_G.TreeList, a)--if tree already cut then it gets removed from the list
  82. end
  83. end
  84. end
  85. end
  86. end
  87. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement