Advertisement
Scriptorz5

Snowman Simulator Autofarm

Dec 14th, 2018
4,132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. _G.farm = true --change to false and execute to stop script
  2.  
  3. local localplayer = game:service"Players".LocalPlayer
  4. local r = game:service("RunService").RenderStepped
  5. local snowballController = game.ReplicatedStorage.ThisGame.Calls.snowballController
  6. local snowballControllerFunc = game.ReplicatedStorage.ThisGame.Calls.snowballControllerFunc
  7. local collectSnow = game.ReplicatedStorage.ThisGame.Calls.collectSnow
  8. local base
  9. local snowballs
  10. local currentsnowballs, maxsnowballs
  11.  
  12. function getbase()
  13. local time = tick()
  14. repeat
  15. for i,v in next, game:service("Workspace").snowmanBases:GetChildren() do
  16. if v:IsA("Part") and v.Name == "LandPlot" and v.player and tostring(v.player.Value) == localplayer.Name then
  17. base = v
  18. end
  19. end
  20. r:wait()
  21. until base ~= nil or tick()-time > 5
  22.  
  23. if base == nil then
  24. -- localplayer:Kick"base not found, aborting."
  25. print("base wasn't found")
  26. return
  27. end
  28. end
  29.  
  30. function checksnowballs()
  31. local time = tick()
  32. repeat
  33. snowballs = localplayer.PlayerGui.Main.leftMenu.snowballs.Frame.textArea.TextLabel
  34. r:wait()
  35. until base ~= nil or tick()-time > 5
  36.  
  37. if snowballs == nil or not snowballs.Text:find("/") then
  38. localplayer:Kick"snowball amount not found, aborting."
  39. return
  40. end
  41.  
  42. function parsesnowballs()
  43. current = snowballs.Text:match("(%d+)/%d+")
  44. max = snowballs.Text:match("%d+/(%d+)")
  45. return tonumber(current), tonumber(max)
  46. end
  47.  
  48. return parsesnowballs()
  49. end
  50.  
  51. function snowballloop()
  52. while r:wait() and _G.farm do
  53. a, currentsnowballs, maxsnowballs = pcall(checksnowballs)
  54. end
  55. end
  56.  
  57. function farmloop()
  58. while r:wait() and _G.farm do
  59. snowballController:FireServer("startRoll")
  60. r:wait(0.1)
  61. collectSnow:FireServer()
  62. r:wait(0.1)
  63. snowballControllerFunc:InvokeServer("stopRoll")
  64. r:wait(0.1)
  65. snowballController:FireServer("addToSnowman")
  66. end
  67. end
  68.  
  69. pcall(getbase)
  70. pcall(spawn, snowballloop)
  71. repeat r:wait() until currentsnowballs ~= nil and maxsnowballs ~= nil
  72. pcall(spawn, farmloop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement