Making Dropbox for Keys in Table Show Up

Untitled
How would I get the dropbox for “IdleAnimation” and “SwingAnimation” to appear after “Animations.”, I would like for it to show it like in the next image.
Untitled

I already defined the type for Animations under NPC as [string]:AnimationTrack, I would like for the keys in the table to show up directly though. Is this possible? Should I use function generics for this? The code I am using is under. (I cutted some code that isn’t important for the context out).

export type NpcObject = {
	Character:Model,
	Humanoid:Humanoid,
	HumanoidRootPart:BasePart,
	Animations:{
		[string]:AnimationTrack
	}
}

local Methods:NpcObject = {}

local Constructor = {}

export type ConstructorValues = {
	Character:Model,
	AnimationTable:{
		[string]:string -- the key would be the name of the animation, the value would be the animation id
		-- ex ["ExampleAnimation"]:rbxassetid:1234567890
	}?,
}


function Constructor.newNPC(ConstructorValues:ConstructorValues):NpcObject
	local NewNpc = table.clone(Methods)
	
	NewNpc.Character = ConstructorValues.Character
	NewNpc.Humanoid = ConstructorValues.Character.Humanoid
	NewNpc.HumanoidRootPart = ConstructorValues.Character.HumanoidRootPart
	
	NewNpc.Animations = {}
	for AnimationName,AnimationId in pairs(ConstructorValues.AnimationTable) do
		local Animator:Animator = NewNpc.Humanoid:FindFirstChild("Animator") or Instance.new("Animator")
		local Animation = Instance.new("Animation")
		
		if not Animator.Parent then Animator.Parent = NewNpc.Humanoid end
		Animation.AnimationId = AnimationId
		
		NewNpc.Animations[AnimationName] = Animator:LoadAnimation(Animation)::AnimationTrack
	end
	
	return NewNpc
end

return Constructor
2 Likes

You would have to create a custom type that contains the names of the animations

1 Like

How would I go about making a custom type on the fly for this?

1 Like

The only way I can imagine doing this is by having a folder of the animations and using typeof on the structure

1 Like