Advertisement
Pastebloxian

lumber tycoon cut and tp wood

Mar 2nd, 2019
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. _G.h = Instance.new("Hint",game.Workspace)
  2. Instance.new("BindableEvent",game.ReplicatedStorage).Name = "Cut"
  3. Instance.new("BindableEvent",game.ReplicatedStorage)
  4. .Name = "Start"
  5. script.Name = "Main"
  6. _G.ClientFolder = Instance.new("Folder",game.Workspace)
  7. _G.ClientFolder.Name="ClientFolder"
  8. _G.rs = game:GetService("RunService").RenderStepped
  9. Sc = Instance.new("ScreenGui",game.Players.LocalPlayer.PlayerGui)
  10. Sc.Name = "CutAndTP"
  11. Sc.ResetOnSpawn = false
  12. _G.GUISS=Sc
  13.  
  14. local Sc3 = Instance.new("TextLabel",Sc)
  15. Sc3.BackgroundColor3 = Color3.new(0.517647, 0.517647, 0.517647)
  16. Sc3.BackgroundTransparency = 0.2
  17. Sc3.Name = "Title"
  18. Sc3.Position = UDim2.new(0, 200, 0, 80)
  19. Sc3.Size = UDim2.new(0, 200, 0, 20)
  20. Sc3.Text = "Select a tree"
  21. Sc3.TextColor3 = Color3.new(0.49, 0.2, 0.40)
  22.  
  23. Sc2 = Instance.new("ScrollingFrame",Sc)
  24. Sc2.Active = true
  25. Sc2.Draggable = true
  26. Sc2.BackgroundColor3 = Color3.new(0.517647, 0.517647, 0.517647)
  27. Sc2.BackgroundTransparency = 0.2
  28. Sc2.Position = UDim2.new(0, 200, 0, 100)
  29. Sc2.Size = UDim2.new(0, 200, 0, 300)
  30. for i,v in pairs(game.Players.LocalPlayer.PlayerGui.CutAndTP.ScrollingFrame:GetChildren()) do
  31. if v.ClassName == "TextButton" then
  32. v.MouseButton1Click:connect(function()
  33. game.ReplicatedStorage.Start:Fire(v.Text)
  34. end)
  35. end
  36. end
  37. Debounce = false
  38. game.ReplicatedStorage.Start.Event:connect(function(TreeName)
  39. _G.GUISS.ScrollingFrame.Visible=false
  40. _G.GUISS.Title.Visible = false
  41. _G.h.Text = "Cutting, put away axe to stop"
  42. for i,v in pairs(game.Workspace:GetChildren()) do
  43. if v.Name == "TreeRegion" then
  44. for i,Tree in pairs(v:GetChildren()) do
  45. _G.rs:wait()
  46. if Tree:FindFirstChild("TreeClass") and Tree.TreeClass.Value == TreeName then
  47. TreeC = Tree.TreeClass
  48. _G.rs:wait()
  49. _G.h.Text = "Cutting Tree: "..TreeC.Value.." at instance: "..i
  50. _G.Cutting = true
  51. _G.FullStop = false
  52. CutEvent = Tree.CutEvent
  53. _G.TREECHILDREN = #CutEvent.Parent:GetChildren()
  54. repeat
  55. _G.rs:wait()
  56. game.ReplicatedStorage.Cut:Fire(CutEvent)
  57. until _G.Cutting == false or _G.FullStop == true
  58. if _G.FullStop == true then
  59. _G.GUISS.ScrollingFrame.Visible = true _G.GUISS.Title.Visible = true
  60. _G.h.Text = "Cutting is stopped, click a tree to start."
  61. return
  62. end
  63. for i,Log in pairs(game.Workspace.LogModels:GetChildren()) do
  64. _G.rs:wait()
  65. if Log:IsA("Model") and Log:FindFirstChild("Owner") and (Log.Owner.Value == game.Players.LocalPlayer or Log.Owner.Value == nil) and Log.TreeClass.Value == TreeName then
  66. game.ReplicatedStorage.Interaction.Verify:FireServer('Item owned by player',Log)
  67. Log:MoveTo(game.Players.LocalPlayer.Character.Head.Position)
  68. game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(Log)
  69. Log.Parent=_G.ClientFolder
  70. wait(0.1)
  71. end
  72. end
  73. end
  74. end
  75. _G.GUISS.ScrollingFrame.Visible = true _G.GUISS.Title.Visible = true
  76. end
  77. _G.h.Text = "Out of trees, or no trees found! Please select another tree."
  78. end
  79. end)
  80. OldP = 0
  81. _G.Cutting = true
  82. _G.FullStop = false
  83. NotFound = false
  84. _G.h.Text = "Cutting is stopped, click a tree to start."
  85. for i,v in pairs(game.Workspace:GetChildren()) do
  86. if v.Name == "TreeRegion" and v:FindFirstChild("Model") and v.Model:FindFirstChild("TreeClass") then
  87. TreeC = v.Model.TreeClass.Value
  88. GUI = Instance.new("TextButton",_G.GUISS.ScrollingFrame)
  89. GUI.Name = TreeC
  90. GUI.Text = TreeC
  91. GUI.TextWrapped = true
  92. GUI.TextScaled = true
  93. GUI.BackgroundTransparency = 0.2
  94. GUI.Size = UDim2.new(0,100,0,40)
  95. if OldP == 0 then
  96. OldP = 10
  97. GUI.Position = UDim2.new(0,50,0,OldP)
  98. else
  99. OldP = OldP+50
  100. GUI.Position = UDim2.new(0,50,0,OldP)
  101. end
  102. end
  103. end
  104. _G.GUISS.ScrollingFrame.Visible = true _G.GUISS.Title.Visible = true
  105. for i,v in pairs(_G.GUISS.ScrollingFrame:GetChildren()) do
  106. if v.ClassName == "TextButton" then
  107. v.MouseButton1Click:connect(function()
  108. game.ReplicatedStorage.Start:Fire(v.Text)
  109. end)
  110. end
  111. end
  112. _G.hitpoints = {}
  113. _G.hitpoints.Axe1 = {0.55}
  114. _G.hitpoints.Axe2 = {0.93}
  115. _G.hitpoints.Axe3 = {1.45}
  116. _G.hitpoints.AxeAlphaTesters = {1.5}
  117. _G.hitpoints.AxeBetaTesters = {1.45}
  118. _G.hitpoints.BasicHatchet = {0.2}
  119. _G.hitpoints.CandyCaneAxe = {0}
  120. _G.hitpoints.EndTimesAxe = {1.58,"LoneCave",1e7}
  121. _G.hitpoints.FireAxe = {"Volcano",6.35}
  122. _G.hitpoints.GoldAxe = {50}
  123. _G.hitpoints.Rukiryaxe = {1.68}
  124. _G.hitpoints.SilverAxe = {1.6}
  125. HitPoints = 0
  126. Continue = false
  127. game.ReplicatedStorage.Cut.Event:connect(function(CutEvent)
  128. _G.h.Text = "Cutting: "..CutEvent.Parent.TreeClass.Value
  129. if game.Players.LocalPlayer.Character:FindFirstChild("Tool") then
  130. Tool = game.Players.LocalPlayer.Character.Tool
  131. ToolNaME = Tool.ToolName.Value
  132. Continue = true
  133. else
  134. game.ReplicatedStorage.Notices.SendUserNotice:Fire("Hold an axe to use this script!")
  135. Continue = false
  136. _G.FullStop = true
  137. _G.Cutting = false
  138. return
  139. end
  140. if Continue == true then
  141. if CutEvent.Parent.TreeClass.Value == _G.hitpoints[ToolNaME][2] then
  142. HitPoints = _G.hitpoints[ToolNaME][3]
  143. else
  144. HitPoints = _G.hitpoints[ToolNaME][1]
  145. end
  146. Continue = false
  147. for i,v in pairs(CutEvent.Parent:GetChildren()) do
  148. game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(CutEvent,{tool=Tool, faceVector=Vector3.new(0, 0, 1), height=1, sectionId=1, hitPoints=HitPoints, cooldown=0, cuttingClass="Axe"})
  149. if #CutEvent.Parent:GetChildren() ~= _G.TREECHILDREN then
  150. _G.Cutting = false
  151. end
  152. end
  153. end
  154. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement