Table.Insert Not working

The title says it all


ToolAnimator.LoadAnimation = function(Table)
	if Table then
		local SetId = Table["ID"]
		
		print(SetId)
		local Animation = Instance.new("Animation")
		Animation.Parent = Character
		Animation.AnimationId = "rbxassetid://".. SetId
		Animation.Name = SetId

		local setAnimation = Humanoid.Animator:LoadAnimation(Animation)	
		setAnimation:Play()
		setAnimation:Stop()
		
		table.insert(MetaTable, SetId, {Id = "AE"})
	else
		warn("Invalid | Table is nil | Load Animation.")
	end
end

when i print the id its 8071348949 but when i put it in a table its [-2147483648] = â–Ľ { ["Id"] = "AE" }

I’m not exactly sure what you’re trying to accomplish, but keep in mind that when there are 3 parameters given in table.insert, the second parameter is reserved for the index value of the inserted datum. In your code, your table.insert 2nd parameter seems to be the ID, and I doubt you are trying to set the datum’s index to the value of the ID.

Im trying to store the Animation id as a key and store the Main Animation into it

1 Like

Okay. I think I’m starting to understand the problem; however, data handling is not my area of expertise. If you do a quick google search of the “minimum 32 bit integer”, you’ll find that it is equal to the value you’re receiving, -2,147,483,648. This leads me to believe that table.insert is not working properly because you’re exceeding the maximum value for a 32-bit device (which is 2, 147, 483, 647) and by default sets the index to the lowest possible index value.

Here’s a little screenshot of my own test.


As you can see, when I inserted “hello” into the 23rd index, everything printed out fine, but when I tried inserting “test” into an index that far exceeded the maximum value for a 64 bit device (I have a 64 bit device), I received nil.
I think you need to change the way you’re setting your indices because they exceed the max 32 bit value.