So I have 2 things called leaderstats inside the player and one is a folder and one is an int value and I want to see if there is a way to use this function without changing the names of everything. So how would I get the folder instead of the int value?
-- function I'm thinking will work
:FindFirstAncestorWhichIsA("Folder")
-- Would I do something like this
:FindFirstAncestorWhichIsA("Folder".."leaderstats")
:FindFirstAncestorWhichIsA() is a function from Instance. Best usage is for a class and its subclasses included, otherwise :FindFirstAncestorOfClass() should be used if it’s only one class.
The first line you wrote will first find an object that is a folder. If it doesn’t find one, it returns nil. The second line won’t work because there are no classes called Folderleaderstats – you’re concatenating the string first. It will never index the IntValue.