local values = {}
values[1]={ xp_requirement=200 } --Make a table in a table, containing all the values
--Nothing else needed here, as you never level up to level 1
values[2]={ xp_requirement=450, cash_bonus=200, maxhp_bonus=0 }
while wait(3) do
local level = script.Parent.Parent.Parent.TextLabel.Crisps
local experience = script.Parent.Parent.Parent.TextLabel.Chocolate
if experience.Value >= values[level.Value[1]] then -- possible solution
level.Value = level.Value + 1
cash = cash + values[level.Value[2]]
end
end
I've been trying to make a level up script which rewards upon level up using tables, however, when it runs in game, nothing happens and I get the following error in console: https://gyazo.com/f7aa075107da11989da8e6dd16ca5d1b

1 comment
The issue is that level.Value is a number, and therefore level.Value[1] is invalid.