Scriptorz5

pet sim #2

Sep 30th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. local amount = 1000 -- experiment with this value, 1000 is maximum and for pets with high levels
  2.  
  3. local coins = game.Workspace:WaitForChild("__REMOTES"):WaitForChild("Coins")
  4. local save = game.Workspace:WaitForChild("__REMOTES"):WaitForChild("Get Other Stats"):InvokeServer()
  5. local plr = game:GetService("Players").LocalPlayer
  6. local petids = {}
  7. local pets = game:GetService("Workspace")["__REMOTES"].Pets
  8. local a = #save[plr.Name]["Save"]["Pets"]
  9. local done = "lol meme"
  10. function random(t)
  11. local keys = {}
  12. for key, value in pairs(t) do
  13. keys[#keys+1] = key
  14. end
  15. index = keys[math.random(1, #keys)]
  16. return t[index]
  17. end
  18. for i=1,a do
  19. if(save[plr.Name]["Save"]["Pets"][a].e == true) then
  20. table.insert(petids, save[plr.Name]["Save"]["Pets"][a].id)
  21. end
  22. a = a - 1
  23. end
  24. function co(b)
  25. local done = b
  26. print("Mining coin: " .. b.Name)
  27. while(b:FindFirstChild"Health" ~= nil and b:FindFirstChild"Health".Value > 0) do
  28. warn(b.Name .. "- Health: " .. b.Health.Value)
  29. wait(0.2)
  30. coins:FireServer("Mine",b.Name, amount, random(petids))
  31. end
  32. end
  33. for _,b in next, workspace.__THINGS.Coins:GetChildren() do
  34. if(done ~= b) then
  35. coroutine.wrap(function()co(b)end)()
  36. end
  37. end
Add Comment
Please, Sign In to add comment