I am trying to create a shop system where you have to buy all the previous items before you can buy the next. For example, if you have item 1 and item 2, you can only buy item 3. Once you buy item 3, you can buy item 4. I am asking for a script concept because I do not want to waste time trying something that is inefficient/not working
You can store a NumberValue that is associated with the highest “rank” item they bought.
If they buy item three, set that NumberValue to 3
.
Now based on that NumberValue you can unlock the fourth item for them.
What if I want some gamepass shop items? Also, that means I would have to hard code the rank of each item?
Then don’t lock the gamepass items.
No, you don’t have to hard code the rank of each one. You can store a folder in ReplicatedStorage that keeps the values of each item, like the cost and the “rank”. When they buy a new item, if that rank is above their current rank, set it to the new value: the one associated with that item.
So I would have to manually do the rank thing for everything. Would there be an easier way using a loop? I am planning to have a lot of items.
I’d say it’s the easiest way to go about it. Can’t think of another method as simple as that one. You could slightly change it and instead make a dictionary contains the Item as the key and the value as, well, the rank value.