Indexing with an integer variable?

I am trying to include a number that increases by one every time it loops, and I want the corresponding imagelabel to change with it.

Cou = Cou + 1
print(Cou)
Frame.Cat[Cou]EquipPic.Visible = true

I get this error of "Cat is not a valid member of ScrollingFrame. I don’t understand why the script is totally ignoring the fact that a number is supposed to be included in the name.

Any help with this would be greatly appreciated!

This is trying to find a child named tostring(Cou) inside of Cat. To look for something named Catn in Frame, do

Frame:FindFirstChild("Cat"..Cou).EquipPic.Visible = true
1 Like

Also if your working with guis you need to use a WaitForChild, like this:

Cou = Cou + 1
print(Cou)
Frame:WaitForChild("Cat" .. Cout .. "EquipPic").Visible = true
--Im assuming the name of the gui is Cat1EquipPic for example
1 Like

Thank you so much for your help!

Yeah, I know. I have something earlier in the code that waits for the GUI to load, but thanks anyways