Custom animation system

So I made an Animation system and it works for the most part.
But when I use an,

for actuallKeyframe,Key in pairs(something:GetChildren()) do end

the actuallKeyframe is not the same as the Key.
Heres a Screenshot below:
image

This is also what it for loops through:
image

local children = something:GetChildren()
table.sort(children, function(a, b) return tonumber(a.Name) < tonumber(b.Name) end)
for actuallKeyframe, key in pairs(children) do 
      print("actuallKeyframe:", actuallKeyframe, "Key:",  key)
end

I forgot tonumber() thank you @doomguy2164 for reminding me

1 Like

Don’t forget to use tonumber() in the second line, right now you’re sorting by string length (?).

2 Likes

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