So I've been wanting to know this question for a bit.
I've made a folder with 5 models in it.... and I wanna know how I could get the last model name in that folder with a script... Is this possible? if so how?
So I've been wanting to know this question for a bit.
I've made a folder with 5 models in it.... and I wanna know how I could get the last model name in that folder with a script... Is this possible? if so how?
If you're familiar with arrays, then you should be aware of :GetChildren(). Since this function returns a collection of the Instance's children, we can address it formally as an array.
It's sensible enough to assume that the last attribute would reside at the last index in a table. Therefore, all we have to do to allocate said last attribute is determine this index. Fortunately, there is no difficulty to this task, as the last index in question is actually numerically relative to the array's size; since ROBLOX's arrays are one-based.
local Models = Models:GetChildren()
local LastModel = Models[#Models]
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Please be more descriptive about your problem.
BazementBoyz, you're on a roll with not reading the question xD