Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. local function yeet()
  2. order = {2, 3} -- example: {2, 1, 3} would load layouts 2, 1, 3 in that order. {1, 2, 3} would load layouts 1, 2, 3 in that order.
  3. _G.enabled = true -- just in case something goes wrong, you can disable it.
  4. autorebirth = true -- self explanatory
  5. --Don't edit anything under
  6. player = game.Players.LocalPlayer
  7. GUI = player.PlayerGui.GUI
  8. layoutGUI = GUI.Layouts
  9. load = game.ReplicatedStorage.Layouts
  10. step = 1
  11. iscomplete = false
  12. finishedload = false
  13. loading = false
  14. profit = false
  15. test = {}
  16. function getLayoutInfo()
  17. local layouts = {}
  18. local results = game.ReplicatedStorage.Layouts:InvokeServer("Check")
  19. if type(results) ~= "table" then
  20. return false
  21. end
  22. for layoutname, result in pairs(results) do
  23. local layout = layoutGUI.Contents:FindFirstChild(layoutname)
  24. if layout then
  25. layouts[layoutname] = {}
  26. layouts[layoutname].cost = 0
  27. layouts[layoutname].items = {}
  28. layouts[layoutname].empty = true
  29. if result == true then
  30. layouts[layoutname].empty = false
  31. elseif type(result) == "table" then
  32. layouts[layoutname].empty = false
  33. local missingItems = {}
  34. local missingCost = 0
  35. for e, Item in pairs(result) do
  36. local itemData = game.ReplicatedStorage.Items:FindFirstChild(Item.ItemName)
  37. if itemData and (itemData.ItemType.Value == 11 or 1 <= itemData.ItemType.Value and itemData.ItemType.Value <= 4) then
  38. missingItems[#missingItems + 1] = {
  39. Name = Item.ItemName,
  40. Amount = Item.Amount,
  41. CostPerUnit = itemData.Cost.Value
  42. }
  43. missingCost = missingCost + itemData.Cost.Value * Item.Amount
  44. end
  45. end
  46. layouts[layoutname].cost = missingCost
  47. layouts[layoutname].items = missingItems
  48. end
  49. end
  50. end
  51. return layouts
  52. end
  53.  
  54. function loadL()
  55. test = getLayoutInfo()
  56. if finishedload or loading then
  57. return
  58. end
  59. loading = true
  60. local t = 'Layout' .. order[step]
  61. local layout = test[t]
  62. if GUI.Money.Value > layout.cost then
  63. print("Ready to load layout " .. step)
  64. if layout.empty then
  65. game:GetService("ReplicatedStorage").DestroyAll:InvokeServer()
  66. wait(3)
  67. load:InvokeServer("Load", t)
  68. else
  69. game:GetService("ReplicatedStorage").DestroyAll:InvokeServer()
  70. wait(3)
  71. load:InvokeServer("Load", t, layout.items)
  72. end
  73. wait(5)
  74. if order[step + 1] ~= nil then
  75. step = step + 1
  76. else
  77. finishedload = true
  78. end
  79. end
  80. loading = false
  81. end
  82. GUI.Money.Changed:connect(function(prop)
  83. if not _G.enabled then
  84. return
  85. end
  86. loadL()
  87. profit = true
  88. wait(10)
  89. profit = false
  90. end)
  91.  
  92. player.Rebirths.Changed:connect(function(prop)
  93. if player.Rebirths.Value == 1 then
  94. _G.enabled = false
  95. end
  96. if _G.enabled then
  97. step = 1
  98. wait(3)
  99. loadL()
  100. end
  101. end)
  102. loadL()
  103.  
  104. while wait(5) do
  105. if not profit then
  106. game.ReplicatedStorage.Rebirth:InvokeServer()
  107. end
  108. end
  109. wait(10)
  110. iscomplete = true
  111. end
  112.  
  113. yeet()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement