So I have a shop system and I used a bunch of bool values for determining what’s owned and whatever. Anyway, I’m pretty sure the way I determined the boolean values was wrong or maybe too
vague, so I’m hoping for some insight and advice. Thanks!
The Script
--indentifying the boolvalues
local prev = index --this is the number for the item the player is trying to purchase
prev -= 1
local folder = script.Parent.boolValues --folder for my values
local prevReq = "b"..prev --each boolValue is named "b(number)" ex. b1, b2 etc.
--this is to determine the previous boolValue
prevReq = tostring(prevReq)
prevReq = folder:WaitForChild(prevReq) --trying to find the boolean based off the name
--repeat for the current boolean value
local bool = "b"..index
bool = tostring("bool")
bool = folder:WaitForChild(bool)
if prevReq then --checking if the previous bool is true
bool.Value = true
end