Finding right child!?!

Is there a way I could do this, I want to make it so it will find the right child is this possible in some way?

local bruh = platesFolder:FindFirstChild("Row"..newRow)

Schermopname (2)

Which child are you trying to find?

one or 2 couse I’m randomizing the number newRow

Not tryna be annoying but what do you mean by new Row?

the random row 1 or 2_________

It should work as intended, you can do that already

Also I suggest you change NewRow to a name that is more intuitive, like RandomRow

You can simply do:

local randomNumber = math.ranodm(1,2)

--etc…
local row = platesFolder:FindFirstChild(“Row”..tostring(randomNumber))
--etc…

You use tostring() because randomNumber is a numbers and you can’t concatenate number with strings unless you sue tostring()

oh so i was right i thought i was dumb lol

Yes you were right, only problem is you used if statements for this which isn’t good practice as it can be 100 elseif statements

Quick correction: You can concatenate numbers and strings just fine:

(This doesn’t apply if the number is first though)

Strange, I don’t remember about that, I remember hearing somewhere it does, try with IntValues, I’m curious now

A quicker way of doing this would be

local row = platesFolder:GetChildren[math.random(1, #platersFolder:GetChildren)]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.