Ok, just finished making changes, try this…
--======================================
--== Multis ==
--======================================
local MultisList = {}
local ButtonsFolder = game:GetService("Workspace").Buttons
for _,Button in ButtonsFolder:GetChildren() do
if Button:IsA("Folder") then
--create data structure for this button
local buttonData = {}
--// Getting Button Stuff
local Base = Button:FindFirstChild("Base")
local Btn = Base.Btn
--//Getting Config Stuff
local Config = Base.Config
local MultiAdd = Config.MultiAdd
local Price = Config.Price
--// Getting Billboard stuff
local bPrice = Base.Price
local bMulti = Base.Multi
--// assigning multi billboard
bPrice.BillboardGui.Price.TextColor3 = Color3.fromRGB(124, 255, 84)
bPrice.BillboardGui.Price.Text = "Price: "..Price.Value
bMulti.BillboardGui.Multi.TextColor3 = Color3.fromRGB(255, 82, 82)
bMulti.BillboardGui.Multi.Text = MultiAdd.Value.."+ Multiplier"
--lets store anything important to the button being pressed, into the buttonData
buttonData.MultiAdd = MultiAdd.Value
buttonData.Price = Price.Value
buttonData.PlayerList = {} --this is a list of players who are touching this button
--// Btn Touch
Btn.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if buttonData.PlayerList[tostring(player.UserId)] == nil then
buttonData.PlayerList[tostring(player.UserId)] = {
Id = player.UserId,
Db = 0
}
end
end
end)
Btn.TouchEnded:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
buttonData.PlayerList[tostring(player.UserId)] = nil
end
end)
table.insert(MultisList,buttonData)
end
end
local function ProcessMultis(buttonData,elapsed)
for k,playerData in pairs(buttonData.PlayerList) do
local plr = game.Players:GetPlayerByUserId(playerData.Id)
if plr and playerData.Db <= 0 then
playerData.Db = playerData.Db - elapsed
--// Getting MainStats Stuff
local MainStats = plr:WaitForChild("MainStats")
local Multiplier = MainStats.Multipliers
local Cash = MainStats.Cash
local Rebirths = MainStats.Rebirths
if Cash.Value >= buttonData.Price then
Cash.Value = Cash.Value - buttonData.Price
if Rebirths.Value >= 1 then
Multiplier.Value = Multiplier.Value + buttonData.MultiAdd * Rebirths.Value
end
end
end
end
end
--======================================
--== Rebirths ==
--======================================
local RebirthsList = {}
local RebirthButtonsFolder = game:GetService("Workspace").RebirthButtons
for _,Button in RebirthButtonsFolder:GetChildren() do
if Button:IsA("Folder") then
--create data structure for this button
local buttonData = {}
--// Getting Button Stuff
local Base = Button:FindFirstChild("Base")
local Btn = Base.Btn
--//Getting Config Stuff
local Config = Base.Config
local RebirthsAdd = Config.RebirthAdd
local Price = Config.Price
--// Getting Billboard stuff
local bPrice = Base.Price
local bMulti = Base.Multi
--// assigning Rebirth billboard
bPrice.BillboardGui.Price.TextColor3 = Color3.fromRGB(255, 82, 82)
bPrice.BillboardGui.Price.Text = "Multiplier Requirement: "..Price.Value
bMulti.BillboardGui.Multi.TextColor3 = Color3.fromRGB(0, 174, 255)
bMulti.BillboardGui.Multi.Text = RebirthsAdd.Value.."+ Rebirths"
--lets store anything important to the button being pressed, into the buttonData
buttonData.Price = Price.Value
buttonData.RebirthsAdd = RebirthsAdd.Value
buttonData.PlayerList = {} --this is a list of players who are touching this button
--// Btn Touch
Btn.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if buttonData.PlayerList[tostring(player.UserId)] == nil then
buttonData.PlayerList[tostring(player.UserId)] = {
Id = player.UserId,
Db = 0
}
end
end
end)
Btn.TouchEnded:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
buttonData.PlayerList[tostring(player.UserId)] = nil
end
end)
table.insert(RebirthsList,buttonData)
end
end
local function ProcessRebirths(buttonData,elapsed)
for k,playerData in pairs(buttonData.PlayerList) do
local plr = game.Players:GetPlayerByUserId(playerData.Id)
if plr and playerData.Db <= 0 then
playerData.Db = playerData.Db - elapsed
--// Getting MainStats Stuff
local MainStats = plr:WaitForChild("MainStats")
local Cash = MainStats.Cash
local Prestiges = MainStats.Prestiges
local Multiplier = MainStats.Multipliers
local Rebirths = MainStats.Rebirths
if Multiplier.Value >= buttonData.Price then
Cash.Value = 0
Multiplier.Value = 1
Rebirths.Value = Rebirths.Value + buttonData.RebirthsAdd * Prestiges.Value
end
end
end
end
--======================================
--== Prestiges ==
--======================================
local PrestigesList = {}
local PrestigeButtonsFolder = game:GetService("Workspace").PrestigeButtons
for _,Button in PrestigeButtonsFolder:GetChildren() do
if Button:IsA("Folder") then
--create data structure for this button
local buttonData = {}
--// Getting Button Stuff
local Base = Button:FindFirstChild("Base")
local Btn = Base.Btn
--//Getting Config Stuff
local Config = Base.Config
local PrestigeAdd = Config.PrestigeAdd
local Price = Config.Price
--// Getting Billboard stuff
local bPrice = Base.Price
local bMulti = Base.Multi
--// assigning Rebirth billboard
bPrice.BillboardGui.Price.TextColor3 = Color3.fromRGB(0, 170, 255)
bPrice.BillboardGui.Price.Text = "Rebirth Requirement: "..Price.Value
bMulti.BillboardGui.Multi.TextColor3 = Color3.fromRGB(170, 85, 255)
bMulti.BillboardGui.Multi.Text = PrestigeAdd.Value.."+ Prestiges"
--lets store anything important to the button being pressed, into the buttonData
buttonData.Price = Price.Value
buttonData.PrestigeAdd = PrestigeAdd.Value
buttonData.PlayerList = {} --this is a list of players who are touching this button
--// Btn Touch
Btn.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if buttonData.PlayerList[tostring(player.UserId)] == nil then
buttonData.PlayerList[tostring(player.UserId)] = {
Id = player.UserId,
Db = 0
}
end
end
end)
Btn.TouchEnded:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
buttonData.PlayerList[tostring(player.UserId)] = nil
end
end)
table.insert(PrestigesList,buttonData)
end
end
local function ProcessPrestiges(buttonData,elapsed)
for k,playerData in pairs(buttonData.PlayerList) do
local plr = game.Players:GetPlayerByUserId(playerData.Id)
if plr and playerData.Db <= 0 then
playerData.Db = playerData.Db - elapsed
--// Getting MainStats Stuff
local MainStats = plr:WaitForChild("MainStats")
local Cash = MainStats.Cash
local Prestiges = MainStats.Prestiges
local Multipliers = MainStats.Multipliers
local Rebirths = MainStats.Rebirths
if Rebirths.Value >= buttonData.Price then
Cash.Value = 0
Multipliers.Value = 0
Rebirths.Value = 0
Prestiges.Value = Prestiges.Value + buttonData.PrestigeAdd
end
end
end
end
--======================================
--== Ultras ==
--======================================
local UltrasList = {}
local UltraButtonsFolder = game:GetService("Workspace").UltraButtons
for _,Button in UltraButtonsFolder:GetChildren() do
if Button:IsA("Folder") then
--create data structure for this button
local buttonData = {}
--// Getting Button Stuff
local Base = Button:FindFirstChild("Base")
local Btn = Base.Btn
--//Getting Config Stuff
local Config = Base.Config
local UltraAdd = Config.UltraAdd
local Price = Config.Price
--// Getting Billboard stuff
local bPrice = Base.Price
local bMulti = Base.Multi
--// assigning Rebirth billboard
bPrice.BillboardGui.Price.TextColor3 = Color3.fromRGB(170, 85, 255)
bPrice.BillboardGui.Price.Text = "Prestige Requirement: "..Price.Value
bMulti.BillboardGui.Multi.TextColor3 = Color3.fromRGB(81, 40, 121)
bMulti.BillboardGui.Multi.Text = UltraAdd.Value.."+ Ultra"
--lets store anything important to the button being pressed, into the buttonData
buttonData.Price = Price.Value
buttonData.RebirthsAdd = UltraAdd.Value
buttonData.PlayerList = {} --this is a list of players who are touching this button
--// Btn Touch
Btn.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if buttonData.PlayerList[tostring(player.UserId)] == nil then
buttonData.PlayerList[tostring(player.UserId)] = {
Id = player.UserId,
Db = 0
}
end
end
end)
Btn.TouchEnded:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
buttonData.PlayerList[tostring(player.UserId)] = nil
end
end)
table.insert(UltrasList,buttonData)
end
end
local function ProcessUltras(buttonData,elapsed)
for k,playerData in pairs(buttonData.PlayerList) do
local plr = game.Players:GetPlayerByUserId(playerData.Id)
if plr and playerData.Db <= 0 then
playerData.Db = playerData.Db - elapsed
--// Getting MainStats Stuff
local MainStats = plr:WaitForChild("MainStats")
local Cash = MainStats.Cash
local Prestiges = MainStats.Prestiges
local Ultra = MainStats.Ultra
local Multipliers = MainStats.Multipliers
local Rebirths = MainStats.Rebirths
if Prestiges.Value >= buttonData.Price then
Prestiges.Value = 0
Multipliers.Value = 0
Rebirths.Value = 0
Cash.Value = 0
Ultra.Value = Ultra.Value + buttonData.UltraAdd
end
end
end
end
local timeElapsed = 0
while true do --process buttons
for n=1,#MultisList do
ProcessMultis(MultisList[n],timeElapsed)
end
for n=1,#RebirthsList do
ProcessRebirths(RebirthsList[n],timeElapsed)
end
for n=1,#PrestigesList do
ProcessPrestiges(PrestigesList[n],timeElapsed)
end
for n=1,#UltrasList do
ProcessUltras(UltrasList[n],timeElapsed)
end
timeElapsed = task.wait()
end
I couldnt really test because I don’t have all your instances, etc…
So if you are getting errors and you can’t figure out what is happeing, or it you just
have questions about what I have done.
Just ask, I might be offline a bit, but I will get back to you.