How do i get the last index in a table?

i have a HumanoidDescription, and if i did

HumanoidDescription:GetAccessories(true)

it will return a table like this with all the HumanoidDescription accessories

image

the HumanoidDescription might have 2 accessories, or 10 accessories, or none
so how can i get the last index always?
i dont care about the value

i am so dump i forgot i can use “#” before the table

local accessories = HumanoidDescription:GetAccessories(true) -- returns a table
local LastIndex = #accessories
print(LastIndex) -- if accessories have 4 items, it will print 4
1 Like

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