Advertisement
Upscalefanatic3

Teleport Script to plants Fantastic Frontier.

Nov 13th, 2018 (edited)
5,985
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. -- Left ctrl to toggle.
  2.  
  3. local Players = game:GetService("Players")
  4. local Workspace = game:GetService("Workspace")
  5. local UserInputService = game:GetService("UserInputService")
  6.  
  7. local root = Workspace[Players.LocalPlayer.Name].HumanoidRootPart
  8. local pfarm = false
  9.  
  10. function checkTP()
  11. if not Workspace.HOLE:FindFirstChild("HoleTPEntrance") then
  12. repeat
  13. local prevPos = root.CFrame
  14. root.CFrame = CFrame.new(1304,96,-525)
  15. wait()
  16. root.CFrame = prevPos
  17. wait(1)
  18. until Workspace.HOLE:FindFirstChild("HoleTPEntrance")
  19. end
  20. end
  21.  
  22. function matchTop(plant)
  23. local list = {
  24. "RisingStarMushroom",
  25. "TheObjectFromEarth",
  26. "TravelerPlant",
  27. "GratefulFrogs",
  28. "Strangeman'sMushroom",
  29. "BrainMushroom",
  30. "FantasticMushroom",
  31. "IcemMushrooms",
  32. "NightmareMushrooms",
  33. "FruitStack",
  34. "StrangemanShells"
  35. }
  36. local name = string.sub(plant.Parent.Name, 9)
  37. for _, names in pairs(list) do
  38. if name == names then
  39. return true
  40. end
  41. end
  42. end
  43.  
  44. function matchLow(plant)
  45. local list = {
  46. "Gorbacabbage",
  47. "GrugbugMushroom",
  48. "AbandonedFlower",
  49. "FifeFlower",
  50. "LoolFlower",
  51. "MoonFlower",
  52. "SunFlower",
  53. "PlumboFlower",
  54. "LemonFlower",
  55. "HungryFlower",
  56. "StrangemanFlower",
  57. "Clamstack",
  58. "SprutleMushroom",
  59. "TargetMushroom",
  60. "BoombaMushroom",
  61. "SnowballMushrooms",
  62. "Mushtache Mushrooms",
  63. "ElephantMushroom",
  64. "AngryBushdwellers"
  65. }
  66. local name = string.sub(plant.Parent.Name, 9)
  67. for _, names in pairs(list) do
  68. if name == names then
  69. return true
  70. end
  71. end
  72. end
  73.  
  74. function interactWithPlant(plant)
  75. -- Assuming "InteractEvent" is a property of a child object of the plant
  76. local interactPart = plant:FindFirstChild("InteractPart")
  77. if interactPart then
  78. interactPart.InteractEvent:FireServer()
  79. end
  80. end
  81.  
  82. function goto(plant)
  83. local hole = Workspace.HOLE.HoleTPEntrance
  84. local pp = plant:FindFirstChild("PP")
  85. if not pp then return end
  86. if (root.Position - pp.Position).magnitude < 200 then
  87. else
  88. hole.Size = Vector3.new(1,1,1)
  89. hole.Transparency = 1
  90. hole.CFrame = root.CFrame
  91. repeat
  92. hole.Position = root.Position
  93. wait()
  94. until (hole.Position - root.Position).magnitude < 10
  95. hole.Position = Vector3.new(1318,85,-527)
  96. hole.Size = Vector3.new(14,5,17)
  97. repeat
  98. wait()
  99. until (root.Position - Vector3.new(430,441,102)).magnitude < 10
  100. local preframe = root.CFrame
  101. if not pp then return end
  102. for i = 1, 5 do
  103. root.Anchored = true
  104. root.CFrame = pp.CFrame + Vector3.new(0,3,0)
  105. wait(.1)
  106. end
  107. end
  108. root.Anchored = false
  109. wait()
  110. if plant.Parent then
  111. repeat
  112. if not pfarm then
  113. root.Anchored = false
  114. return
  115. end
  116. root.Anchored = true
  117. root.CFrame = pp.CFrame + Vector3.new(0,3,0)
  118. root.Anchored = false
  119. wait()
  120. interactWithPlant(plant)
  121. wait(.08)
  122. until plant.Parent == nil
  123. end
  124. root.Anchored = false
  125. end
  126.  
  127. UserInputService.InputBegan:Connect(function(input)
  128. if input.KeyCode == Enum.KeyCode.LeftControl and pfarm then
  129. print("Plant Farm Off")
  130. pfarm = false
  131. elseif input.KeyCode == Enum.KeyCode.LeftControl and not pfarm then
  132. print("Plant Farm On")
  133. pfarm = true
  134. checkTP()
  135. while pfarm do
  136. for i, plant in pairs(Workspace.Spawners:GetDescendants()) do
  137. if not pfarm then return end
  138. if plant.Name == "Collectible" and plant.Parent and matchTop(plant) then
  139. print("Going to "..string.sub(plant.Parent.Name, 9))
  140. goto(plant)
  141. wait()
  142. end
  143. end
  144. wait(.2)
  145. for i, plant in pairs(Workspace.Spawners:GetDescendants()) do
  146. if not pfarm then return end
  147. if plant.Name == "Collectible" and plant.Parent and matchLow(plant) then
  148. print("Going to "..string.sub(plant.Parent.Name, 9))
  149. goto(plant)
  150. wait()
  151. break
  152. end
  153. end
  154. end
  155. end
  156. end)
  157.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement