Hello!
I’m trying to make a capacity upgrade system for my simulator. I wrote a small script already.
local Player = game:GetService('Players').LocalPlayer
local Max = Player:WaitForChild('BackpackCapacity')
local Whacks = Player:WaitForChild('Whacks')
local MainFrame = script.Parent:WaitForChild('Frame')
local find,insert,remove = table.find,table.insert,table.remove
local CapacityAmounts = {
Capacity1 = {
Price = 50,
Capacity = 25
},
Capacity2 = {
Price = 100,
Capacity = 50
},
Capacity3 = {
Price = 250,
Capacity = 100
},
}
Max:GetPropertyChangedSignal('Value'):Connect(function()
local OldCapacity = Max.Value
MainFrame.Description.Text = 'Upgrade Capacity from '..Max.Value..' to NEW_CAPACITY?'
end)
MainFrame.UpgradeButton.MouseButton1Click:Connect(function()
end)
The problem is, is that I’m trying to get the old capacity and then find the new one. How would I search all the prices in the table to get the old price? I thought about using table.find, but the prices are in sub-tables, and I do not know which price the old one is.