Needing Help Detecting An Instance By Using A Variable

I’m trying to create a simulator game, and need to access capacity based on tiers (Example, tier 1 has 10 capacity). I need a way to extract this information based on their current tier of capacity.

The problem is each tier is set in server storage as shown below:
CapacityLol

Each folder is named Tier[Number] and the number is based on the player’s current tier of capacity. I cannot find an easy way however to find the correct folder I need.

I’ve tried using this line of code:
local Tier = ServerStorage.CapacityTierData:WaitForChild("Tier"..player.StoreData.CapacityTier)

I’ve also tried looking up possible solutions on the devforum and the roblox developer page, but I’ve not found any way to fix my problem.

How can I detect the correct folder? Should I change the way I’m detecting it?

You should be able to find the correct tier by just using a naming convention like “Tier”…[TIER_LEVEL]. If you wanted to be safe you could use the FindFirstChild method and catch any unsuccessful attempts. Another route you could take would be to move all the data into a ModuleScript something like this:

local CapacityTierData = {}

CapacityTierData.Levels = {
   [1] = {
      Capacity = 10,
      Cost = 100,
      Name = "Level 1"
   },
   [2] = {
      Capacity = 15,
      Cost = 150,
      Name = "Level 2"
   },
   --... (and so on)
}

function CapacityTierData.GetTierData(level)
   return CapacityTierData.Levels[level]
end

return CapacityTierData

The function GetTierData is technically not necessary, but might be handy for code readability. Also the explicit indexing of each tier within the table is also unnecessary, but is fine to include just for sanity or for easy readability and reference when modifying the tiers.