Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function yeet()
- 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.
- _G.enabled = true -- just in case something goes wrong, you can disable it.
- autorebirth = true -- self explanatory
- --Don't edit anything under
- player = game.Players.LocalPlayer
- GUI = player.PlayerGui.GUI
- layoutGUI = GUI.Layouts
- load = game.ReplicatedStorage.Layouts
- step = 1
- iscomplete = false
- finishedload = false
- loading = false
- profit = false
- test = {}
- function getLayoutInfo()
- local layouts = {}
- local results = game.ReplicatedStorage.Layouts:InvokeServer("Check")
- if type(results) ~= "table" then
- return false
- end
- for layoutname, result in pairs(results) do
- local layout = layoutGUI.Contents:FindFirstChild(layoutname)
- if layout then
- layouts[layoutname] = {}
- layouts[layoutname].cost = 0
- layouts[layoutname].items = {}
- layouts[layoutname].empty = true
- if result == true then
- layouts[layoutname].empty = false
- elseif type(result) == "table" then
- layouts[layoutname].empty = false
- local missingItems = {}
- local missingCost = 0
- for e, Item in pairs(result) do
- local itemData = game.ReplicatedStorage.Items:FindFirstChild(Item.ItemName)
- if itemData and (itemData.ItemType.Value == 11 or 1 <= itemData.ItemType.Value and itemData.ItemType.Value <= 4) then
- missingItems[#missingItems + 1] = {
- Name = Item.ItemName,
- Amount = Item.Amount,
- CostPerUnit = itemData.Cost.Value
- }
- missingCost = missingCost + itemData.Cost.Value * Item.Amount
- end
- end
- layouts[layoutname].cost = missingCost
- layouts[layoutname].items = missingItems
- end
- end
- end
- return layouts
- end
- function loadL()
- test = getLayoutInfo()
- if finishedload or loading then
- return
- end
- loading = true
- local t = 'Layout' .. order[step]
- local layout = test[t]
- if GUI.Money.Value > layout.cost then
- print("Ready to load layout " .. step)
- if layout.empty then
- game:GetService("ReplicatedStorage").DestroyAll:InvokeServer()
- wait(3)
- load:InvokeServer("Load", t)
- else
- game:GetService("ReplicatedStorage").DestroyAll:InvokeServer()
- wait(3)
- load:InvokeServer("Load", t, layout.items)
- end
- wait(5)
- if order[step + 1] ~= nil then
- step = step + 1
- else
- finishedload = true
- end
- end
- loading = false
- end
- GUI.Money.Changed:connect(function(prop)
- if not _G.enabled then
- return
- end
- loadL()
- profit = true
- wait(10)
- profit = false
- end)
- player.Rebirths.Changed:connect(function(prop)
- if player.Rebirths.Value == 1 then
- _G.enabled = false
- end
- if _G.enabled then
- step = 1
- wait(3)
- loadL()
- end
- end)
- loadL()
- while wait(5) do
- if not profit then
- game.ReplicatedStorage.Rebirth:InvokeServer()
- end
- end
- wait(10)
- iscomplete = true
- end
- yeet()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement