Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I animate large humanoid figures with script?

I am making a sort of survival game with a twist, and I'm trying to create somewhat of a boss for it. The dimensions for the boss are exactly three times the normal humanoid dimensions. The only problem is, simply dragging the animation script from a normal zombie to the giant one causes the giant to become disfigured and distorted. Bare in mind it does carry a sword with the dimensions also exactly multiplied by three. I was wondering if there was a way around this, or just simply a script someone could create for me? I've tried using several animation plugins but the limbs and head are never detected after selecting the root part of the "dummy". I also made sure to duplicate the joints within the torso and replicated the data from within the original zombie.

This is the current animation script, it is fairly independent:


function waitForChild(parent, childName)

 	while true do

 		local child = parent:findFirstChild(childName)

 		if child then

 			return child

 		end

 		parent.ChildAdded:wait()

 	end

 end

 local Figure = script.Parent

 local Torso = waitForChild(Figure, "Torso")

 local RightShoulder = waitForChild(Torso, "Right Shoulder")

 local LeftShoulder = waitForChild(Torso, "Left Shoulder")

 local RightHip = waitForChild(Torso, "Right Hip")

 local LeftHip = waitForChild(Torso, "Left Hip")

 local Neck = waitForChild(Torso, "Neck")

 local Humanoid = waitForChild(Figure, "Zombie")

 local pose = "Standing"

 

 local toolAnim = "None"

 local toolAnimTime = 0

 

 local isSeated = false

 

 -- functions

 

 function onRunning(speed)

 	if isSeated then return end

 

 	if speed>0 then

 		pose = "Running"

 	else

 		pose = "Standing"

 	end

 end

 

 function onDied()

 	pose = "Dead"

 end

 

 function onJumping()

 	isSeated = false

 	pose = "Jumping"

 end

 

 function onClimbing()

 	pose = "Climbing"

 end

 

 function onGettingUp()

 	pose = "GettingUp"

 end

 

 function onFreeFall()

 	pose = "FreeFall"

 end

 

 function onFallingDown()

 	pose = "FallingDown"

 end

 

 function onSeated()

 	isSeated = true

 	pose = "Seated"

 	print("Seated")

 end

 

 function moveJump()

 	RightShoulder.MaxVelocity = 0.5

 	LeftShoulder.MaxVelocity = 0.5

 	RightShoulder.DesiredAngle = 3.14

 	LeftShoulder.DesiredAngle = -3.14

 	RightHip.DesiredAngle = 0

 	LeftHip.DesiredAngle = 0

 end

 

-- same as jump for now

function moveFreeFall()

 	RightShoulder.MaxVelocity = 0.5

 	LeftShoulder.MaxVelocity = 0.5

 	RightShoulder.DesiredAngle = 3.14

 	LeftShoulder.DesiredAngle = -3.14

 	RightHip.DesiredAngle = 0

 	LeftHip.DesiredAngle = 0

 end

 

 function moveSit()

 	print("Move Sit")

 	RightShoulder.MaxVelocity = 0.15

 	LeftShoulder.MaxVelocity = 0.15

 	RightShoulder.DesiredAngle = 3.14 /2

 	LeftShoulder.DesiredAngle = -3.14 /2

 	RightHip.DesiredAngle = 3.14 /2

 	LeftHip.DesiredAngle = -3.14 /2

 end

 

 function getTool()

 	

 	kidTable = Figure:children()

 	if (kidTable ~= nil) then

 		numKids = #kidTable

 		for i=1,numKids do

 			if (kidTable[i].className == "Tool") then return kidTable[i] end

 		end

 	end

 	

 	return nil

 end

 

 function getToolAnim(tool)

 

 	c = tool:children()

 	for i=1,#c do

 		if (c[i].Name == "toolanim" and c[i].className == "StringValue") then

 			return c[i]

 		end

 	end

 	return nil

 end

 

 function animateTool()

 	

 	if (toolAnim == "None") then

 		RightShoulder.DesiredAngle = 1.57

 		return

 	end

 

 	if (toolAnim == "Slash") then

 		RightShoulder.MaxVelocity = 0.5

 		RightShoulder.DesiredAngle = 0

 		return

 	end

 

 	if (toolAnim == "Lunge") then

 		RightShoulder.MaxVelocity = 0.5

 		LeftShoulder.MaxVelocity = 0.5

 		RightHip.MaxVelocity = 0.5

 		LeftHip.MaxVelocity = 0.5

 		RightShoulder.DesiredAngle = 1.57

 		LeftShoulder.DesiredAngle = 1.0

 		RightHip.DesiredAngle = 1.57

 		LeftHip.DesiredAngle = 1.0

 		return

 	end

 end

 

 function move(time)

 	local amplitude

 	local frequency

 

 	if (pose == "Jumping") then

 		moveJump()

 		return

 	end

 

 	if (pose == "FreeFall") then

 		moveFreeFall()

 		return

 	end

  

 	if (pose == "Seated") then

 		moveSit()

 		return

 	end

  

 	local climbFudge = 0

 	

 	if (pose == "Running") then

 		RightShoulder.MaxVelocity = 0.15

 		LeftShoulder.MaxVelocity = 0.15

 		amplitude = 1

 		frequency = 9

 	elseif (pose == "Climbing") then

 		RightShoulder.MaxVelocity = 0.5 

 		LeftShoulder.MaxVelocity = 0.5

  		amplitude = 1

 		frequency = 9

 		climbFudge = 3.14

 	else

 		amplitude = 0.1

 		frequency = 1

 	end

 

 	desiredAngle = amplitude * math.sin(time*frequency)

 

 	RightShoulder.DesiredAngle = desiredAngle + climbFudge

 	LeftShoulder.DesiredAngle = desiredAngle - climbFudge

 	RightHip.DesiredAngle = -desiredAngle

 	LeftHip.DesiredAngle = -desiredAngle

 

 

 	local tool = getTool()

 

 	if tool ~= nil then

 	

 		animStringValueObject = getToolAnim(tool)

 

 		if animStringValueObject ~= nil then

 			toolAnim = animStringValueObject.Value

 			-- message recieved, delete StringValue

 			animStringValueObject.Parent = nil

 			toolAnimTime = time + .3

 		end

 

 		if time > toolAnimTime then

 			toolAnimTime = 0

 			toolAnim = "None"

 		end

 

 		animateTool()

 

 		

 	else

 		toolAnim = "None"

 		toolAnimTime = 0

 	end

 end

 

 

 -- connect events

 

 Humanoid.Died:connect(onDied)

 Humanoid.Running:connect(onRunning)

 Humanoid.Jumping:connect(onJumping)

 Humanoid.Climbing:connect(onClimbing)

 Humanoid.GettingUp:connect(onGettingUp)

 Humanoid.FreeFalling:connect(onFreeFall)

 Humanoid.FallingDown:connect(onFallingDown)

 Humanoid.Seated:connect(onSeated)

 

 -- main program

 

 local nextTime = 0

 local runService = game:service("RunService");

 

 while Figure.Parent~=nil do

 	time = runService.Stepped:wait()

 	if time > nextTime then

 		move(time)

 		nextTime = time + 0.1

 	end

 end

Thanks in advance!

-ItsYourFav (zacster129)

1 comment

0

When you used the connect events, you used :connect() instead of :Connect() :connect()wouldn't work in the released game so that's why you should use :Connect() instead of :connect()

1 answer

To animate a bigger humanoid, you can use : [](http://(https://www.roblox.com/library/171922549/Character-Creator-BETA) to attach your custom arms and legs to your custom character. It is also compatible with the Roblox Animation Editor

2 comments

0

Model Rigger by CloneTrooper1019 is probably the most easiest approach. https://www.roblox.com/library/188486042/Model-Rigger-Plugin

0

Thank you so much! I was finally able to detect the limbs with the animation maker using the Character Creator! Thanks again, I would've never been able to figure this out myself!

This discussion is preserved as it was. New answers, comments, and votes are closed.