Figure=script.Parent RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")Creator=Figure:FindFirstChild("\067\114\101\097\116\111\114")Humanoid=Figure:WaitForChild("\072\117\109\097\110\111\105\100")Head=Figure:WaitForChild("\072\101\097\100")Torso=Figure:WaitForChild("\084\111\114\115\111")Neck=Torso:WaitForChild("\078\101\099\107")LeftShoulder=Torso:WaitForChild("\076\101\102\116 \083\104\111\117\108\100\101\114")RightShoulder=Torso:WaitForChild("\082\105\103\104\116 \083\104\111\117\108\100\101\114")LeftHip=Torso:WaitForChild("\076\101\102\116 \072\105\112")RightHip=Torso:WaitForChild("\082\105\103\104\116 \072\105\112")for Y,n in pairs({LeftShoulder,RightShoulder;LeftHip,RightHip})do if n and n.Parent then n.DesiredAngle=0 n.CurrentAngle=0 end end Pose="\078\111\110\101"LastPose=Pose PoseTime=tick()ToolAnimTime=0 function SetPose(Y)LastPose=Pose Pose=Y PoseTime=tick()end function OnRunning(Y)if Y>0 then SetPose("\082\117\110\110\105\110\103")else SetPose("\083\116\097\110\100\105\110\103")end end function OnDied()SetPose("\068\101\097\100")end function OnJumping()SetPose("\074\117\109\112\105\110\103")end function OnClimbing()SetPose("\067\108\105\109\098\105\110\103")end function OnGettingUp()SetPose("\071\101\116\116\105\110\103\085\112")end function OnFreeFall()SetPose("\070\114\101\101\070\097\108\108")end function OnFallingDown()SetPose("\070\097\108\108\105\110\103\068\111\119\110")end function OnSeated()SetPose("\083\101\097\116\101\100")end function OnPlatformStanding()SetPose("\080\108\097\116\102\111\114\109\083\116\097\110\100\105\110\103")end function OnSwimming(Y)return OnRunning(Y)end function MoveJump()RightShoulder.MaxVelocity=.15 LeftShoulder.MaxVelocity=.15 RightShoulder.DesiredAngle=.5 LeftShoulder.DesiredAngle=-0.5 RightHip.DesiredAngle=-0.5 LeftHip.DesiredAngle=.5 end function MoveFreeFall()RightShoulder.MaxVelocity=.15 LeftShoulder.MaxVelocity=.15 RightShoulder.DesiredAngle=.5 LeftShoulder.DesiredAngle=-0.5 RightHip.DesiredAngle=-0.5 LeftHip.DesiredAngle=.5 end function MoveSit()RightShoulder.MaxVelocity=.15 LeftShoulder.MaxVelocity=.15 RightShoulder.DesiredAngle=math.pi/2 LeftShoulder.DesiredAngle=-(math.pi/2)RightHip.DesiredAngle=1 LeftHip.DesiredAngle=-1 end function GetTool()for Y,n in pairs(Figure:GetChildren())do if n:IsA("\084\111\111\108")then return n end end end function GetToolAnim(Y)for Y,n in pairs(Y:GetChildren())do if n:IsA("\083\116\114\105\110\103\086\097\108\117\101")and n.Name=="\084\111\111\108\065\110\105\109"then return n end end return nil end function AnimateTool()if ToolAnim=="\078\111\110\101"then return end if ToolAnim=="\083\108\097\115\104"then RightShoulder.MaxVelocity=.5 RightShoulder.DesiredAngle=0 return end if ToolAnim=="\076\117\110\103\101"then RightShoulder.MaxVelocity=.5 LeftShoulder.MaxVelocity=.5 RightHip.MaxVelocity=.5 LeftHip.MaxVelocity=.5 RightShoulder.DesiredAngle=math.pi/2 LeftShoulder.DesiredAngle=0 RightHip.DesiredAngle=math.pi/2 LeftHip.DesiredAngle=1 return end end function Move(Y)local n local o local C local b local v if Pose=="\074\117\109\112\105\110\103"then MoveJump()return elseif Pose=="\070\114\101\101\070\097\108\108"then MoveFreeFall()return elseif Pose=="\083\101\097\116\101\100"then MoveSit()return end local M=0 if Pose=="\082\117\110\110\105\110\103"then RightShoulder.MaxVelocity=.15 LeftShoulder.MaxVelocity=.15 n=1 o=9 C=0 b=0 v=0 elseif Pose=="\067\108\105\109\098\105\110\103"then RightShoulder.MaxVelocity=.5 LeftShoulder.MaxVelocity=.5 n=1 o=9 C=0 b=0 v=0 M=math.pi else n=.1 o=1 C=.25 b=1.25 end v=not v and C*math.sin(Y*b)or v local X=n*math.sin(Y*o)RightShoulder.DesiredAngle=X+M LeftShoulder.DesiredAngle=X-M RightHip.DesiredAngle=-X LeftHip.DesiredAngle=-X local f=GetTool()if f then local n=GetToolAnim(f)if n then ToolAnim=n.Value if n and n.Parent then n:Destroy()end ToolAnimTime=Y+.3 end if Y>ToolAnimTime then ToolAnimTime=0 ToolAnim="\078\111\110\101"end AnimateTool()else ToolAnim="\078\111\110\101"ToolAnimTime=0 end end 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)Humanoid.PlatformStanding:connect(OnPlatformStanding)Humanoid.Swimming:connect(OnSwimming)Humanoid:ChangeState(Enum.HumanoidStateType.None)RunService.Stepped:connect(function()local Y,n=wait(.1)Move(n)end)
--Made by Luckymaxer

Figure = script.Parent

RunService = game:GetService("RunService")

Creator = Figure:FindFirstChild("Creator")

Humanoid = Figure:WaitForChild("Humanoid")
Head = Figure:WaitForChild("Head")
Torso = Figure:WaitForChild("Torso")

Neck = Torso:WaitForChild("Neck")
LeftShoulder = Torso:WaitForChild("Left Shoulder")
RightShoulder = Torso:WaitForChild("Right Shoulder")
LeftHip = Torso:WaitForChild("Left Hip")
RightHip = Torso:WaitForChild("Right Hip")

for i, v in pairs({--[[Neck, ]]
	LeftShoulder,
	RightShoulder,
	LeftHip,
	RightHip,
}) do
	if v and v.Parent then
		v.DesiredAngle = 0
		v.CurrentAngle = 0
	end
end

Pose = "None"
LastPose = Pose
PoseTime = tick()

ToolAnimTime = 0

function SetPose(pose)
	LastPose = Pose
	Pose = pose
	PoseTime = tick()
end

function OnRunning(Speed)
	if Speed > 0 then
		SetPose("Running")
	else
		SetPose("Standing")
	end
end

function OnDied()
	SetPose("Dead")
end

function OnJumping()
	SetPose("Jumping")
end

function OnClimbing()
	SetPose("Climbing")
end

function OnGettingUp()
	SetPose("GettingUp")
end

function OnFreeFall()
	SetPose("FreeFall")
end

function OnFallingDown()
	SetPose("FallingDown")
end

function OnSeated()
	SetPose("Seated")
end

function OnPlatformStanding()
	SetPose("PlatformStanding")
end

function OnSwimming(Speed)
	return OnRunning(Speed)
end

function MoveJump()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder.DesiredAngle = 0.5
	LeftShoulder.DesiredAngle = -0.5
	RightHip.DesiredAngle = -0.5
	LeftHip.DesiredAngle = 0.5
end

function MoveFreeFall()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder.DesiredAngle = 0.5
	LeftShoulder.DesiredAngle = -0.5
	RightHip.DesiredAngle = -0.5
	LeftHip.DesiredAngle = 0.5
end

function MoveSit()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder.DesiredAngle = (math.pi / 2)
	LeftShoulder.DesiredAngle = -(math.pi / 2)
	RightHip.DesiredAngle = 1
	LeftHip.DesiredAngle = -1
end

function GetTool()
	for i, v in pairs(Figure:GetChildren()) do
		if v:IsA("Tool") then
			return v
		end
	end
end

function GetToolAnim(Tool)
	for i, v in pairs(Tool:GetChildren()) do
		if v:IsA("StringValue") and v.Name == "ToolAnim" then
			return v
		end
	end
	return nil
end

function AnimateTool()
	if ToolAnim == "None" then
		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 = (math.pi / 2)
		LeftShoulder.DesiredAngle = 0
		RightHip.DesiredAngle = (math.pi / 2)
		LeftHip.DesiredAngle = 1
		return
	end
end

function Move(Time)
	local LimbAmplitude
	local LimbFrequency
	local NeckAmplitude
	local NeckFrequency
	local NeckDesiredAngle

	if Pose == "Jumping" then
		MoveJump()
		return
	elseif Pose == "FreeFall" then
		MoveFreeFall()
		return
	elseif Pose == "Seated" then
		MoveSit()
		return
	end

	local ClimbFudge = 0

	if Pose == "Running" then
		RightShoulder.MaxVelocity = 0.15
		LeftShoulder.MaxVelocity = 0.15
		LimbAmplitude = 1
		LimbFrequency = 9
		NeckAmplitude = 0
		NeckFrequency = 0
		NeckDesiredAngle = 0
		--[[if Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character then
			local CreatorCharacter = Creator.Value.Character
			local CreatorHead = CreatorCharacter:FindFirstChild("Head")
			if CreatorHead then
				local TargetPosition = CreatorHead.Position
				local Direction = Torso.CFrame.lookVector
				local HeadPosition = Head.Position
				NeckDesiredAngle = ((((HeadPosition - TargetPosition).Unit):Cross(Direction)).Y / 4)
			end
		end]]
	elseif Pose == "Climbing" then
		RightShoulder.MaxVelocity = 0.5
		LeftShoulder.MaxVelocity = 0.5
		LimbAmplitude = 1
		LimbFrequency = 9
		NeckAmplitude = 0
		NeckFrequency = 0
		NeckDesiredAngle = 0
		ClimbFudge = math.pi
	else
		LimbAmplitude = 0.1
		LimbFrequency = 1
		NeckAmplitude = 0.25
		NeckFrequency = 1.25
	end

	NeckDesiredAngle = ((not NeckDesiredAngle and (NeckAmplitude * math.sin(Time * NeckFrequency))) or NeckDesiredAngle)
	local LimbDesiredAngle = (LimbAmplitude * math.sin(Time * LimbFrequency))

	--Neck.DesiredAngle = NeckDesiredAngle
	RightShoulder.DesiredAngle = (LimbDesiredAngle + ClimbFudge)
	LeftShoulder.DesiredAngle = (LimbDesiredAngle - ClimbFudge)
	RightHip.DesiredAngle = -LimbDesiredAngle
	LeftHip.DesiredAngle = -LimbDesiredAngle

	local Tool = GetTool()

	if Tool then
		local AnimStringValueObject = GetToolAnim(Tool)

		if AnimStringValueObject then
			ToolAnim = AnimStringValueObject.Value
			if AnimStringValueObject and AnimStringValueObject.Parent then
				AnimStringValueObject:Destroy()
			end
			ToolAnimTime = (Time + 0.3)
		end

		if Time > ToolAnimTime then
			ToolAnimTime = 0
			ToolAnim = "None"
		end

		AnimateTool()
	else
		ToolAnim = "None"
		ToolAnimTime = 0
	end
end

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)
Humanoid.PlatformStanding:connect(OnPlatformStanding)
Humanoid.Swimming:connect(OnSwimming)

Humanoid:ChangeState(Enum.HumanoidStateType.None)

RunService.Stepped:connect(function()
	local _, Time = wait(0.1)
	Move(Time)
end)
