Advertisement
ZerroxxOne

Auto Collect

Apr 4th, 2020
3,712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. --Settigs:
  2. },
  3. ['AutoCollect'] = {
  4. ['Cooldown'] = 3,
  5. ['Collect'] = true,
  6. },
  7. }
  8.  
  9.  
  10. --AutoCollect: Vergessen zu erwähnen, erstellt euch ein Script unter "Workspace" und Fügt dort diese Script ein.
  11.  
  12.  
  13. local Tycoon = script.Parent.Parent
  14. local TycoonTeamColor = script.Parent.TeamColor
  15. local CurrencyToCollect = script.Parent.CurrencyToCollect
  16. local Owner = script.Parent.Owner
  17. local Settings = require(script.Parent.Parent.Parent.Settings)
  18. local CurrentPlr = nil
  19. local CurrentPlrId = 0
  20. local cooldown = Settings.AutoCollect.Cooldown
  21.  
  22. Owner.Changed:Connect(function()
  23. if Settings.AutoCollect.Collect == true then
  24. print(Settings.AutoCollect.Collect)
  25. if Owner.Value ~= nil then
  26. repeat
  27. wait(cooldown)
  28. for i, v in pairs(game:GetService("Players"):GetChildren()) do
  29. if v.TeamColor == TycoonTeamColor.Value then
  30. if CurrentPlr ~= v.Name then
  31. CurrentPlr = v.Name
  32. local success, err = pcall(function()
  33. id = game:GetService("Players"):GetUserIdFromNameAsync(CurrentPlr)
  34. end)
  35. if success then
  36. CurrentPlrId = id
  37. end
  38. if err then
  39. print("Error while using :GetUserIdFromNameAsync()")
  40. end
  41. print(CurrentPlr)
  42. print(CurrentPlrId)
  43. end
  44. if game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name) then
  45. if CurrencyToCollect.Value ~= 0 then
  46. --local GamePassId = 0
  47. --if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(CurrentPlrId,GamePassId) then
  48. --game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value = game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value + CurrencyToCollect.Value * 2
  49. --CurrencyToCollect.Value = 0
  50. --else
  51. game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value = game.ServerStorage:FindFirstChild("PlayerMoney"):FindFirstChild(v.Name).Value + CurrencyToCollect.Value
  52. CurrencyToCollect.Value = 0
  53. end
  54. end
  55. end
  56. end
  57. until Owner.Value == nil
  58. else
  59. end
  60. end
  61. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement