NPC Kit Companion - Open Source

I’ve been making use of the Roblox NPC Kit and discovered that there were a number of animations defined for the Robot, Soldier and Zombie. So I created this utility to allow me to see them in action. I figured this might be handy for others so I’m making it open source. Enjoy.

https://www.roblox.com/games/7631510291/Jaxxon-Jargons-NPC-Kit-Companion

7 Likes

In case anyone is interested, this is what the code looks like:

local function animateCharacter(character, id)
	local humanoid = character:WaitForChild("Humanoid")
	local animator = humanoid:WaitForChild("Animator")
	local animation = Instance.new("Animation")
	animation.AnimationId = "rbxassetid://" .. id
	local animationTrack = animator:LoadAnimation(animation)
	animationTrack.Looped = false
	animationTrack:Play()
end

local function animateAll(id)
	animateCharacter(workspace.Robot, id)
	animateCharacter(workspace.Soldier, id)
	animateCharacter(workspace.Zombie, id)
end

local animations = {
	Cheer = "507770677",
	Climb = "616156119",
	DanceA1 = "507771019",
	DanceA2 = "507771955",
	DanceA3 = "507772104",
	DanceB1 = "507776043",
	DanceB2 = "507776720",
	DanceB3 = "507776879",
	DanceC1 = "507777268",
	DanceC2 = "507777451",
	DanceC3 = "507777623",
	Fall = "616157476",
	Idle1 = "3489171152",
	Idle2 = "3489171152",
	Jump = "616161997",
	Laugh = "507770818",
	Point = "507770453",
	Pose = "885545458",
	Run = "3489173414",
	Sit = "2506281703",
	Swim = "616165109",
	SwimIdle = "616166655",
	ToolLunge = "522638767",
	ToolNone = "507768375",
	ToolSlash = "522635514",
	Walk = "3489174223",
	Wave = "507770239",
}

local names = {}

for name, _ in pairs(animations) do
	table.insert(names, name)
end

table.sort(names)

for _, name in ipairs(names) do
	local id = animations[name]
	button = Instance.new("TextButton")
	button.Name = name .. "Button"
	button.Text = name
	button.Size = UDim2.new(0, 200, 0, 25)
	button.SizeConstraint = Enum.SizeConstraint.RelativeXY
	button.Activated:Connect(function()
		animateAll(id)
	end)
	button.Parent = script.Parent
end

Nice but can you show us a video :+1:

3 Likes