-- Decompiled with the Synapse X Luau decompiler.


local l__Parent__1 = script.Parent;
local l__Torso__2 = l__Parent__1:WaitForChild("Torso");
local l__Right_Shoulder__3 = l__Torso__2:WaitForChild("Right Shoulder");
local l__Left_Shoulder__4 = l__Torso__2:WaitForChild("Left Shoulder");
local l__Right_Hip__5 = l__Torso__2:WaitForChild("Right Hip");
local l__Left_Hip__6 = l__Torso__2:WaitForChild("Left Hip");
local l__Neck__7 = l__Torso__2:WaitForChild("Neck");
local l__Humanoid__8 = l__Parent__1:WaitForChild("Humanoid");
local u1 = {};
function configureAnimationSet(p1, p2)
	if u1[p1] ~= nil then
		local v9, v10, v11 = pairs(u1[p1].connections);
		while true do
			local v12, v13 = v9(v10, v11);
			if v12 then

			else
				break;
			end;
			v11 = v12;
			v13:disconnect();		
		end;
	end;
	u1[p1] = {};
	u1[p1].count = 0;
	u1[p1].totalWeight = 0;
	u1[p1].connections = {};
	local v14 = script:FindFirstChild(p1);
	if v14 ~= nil then
		table.insert(u1[p1].connections, v14.ChildAdded:connect(function(p3)
			configureAnimationSet(p1, p2);
		end));
		table.insert(u1[p1].connections, v14.ChildRemoved:connect(function(p4)
			configureAnimationSet(p1, p2);
		end));
		local v15 = 1;
		local v16, v17, v18 = pairs(v14:GetChildren());
		while true do
			local v19, v20 = v16(v17, v18);
			if v19 then

			else
				break;
			end;
			v18 = v19;
			if v20:IsA("Animation") then
				table.insert(u1[p1].connections, v20.Changed:connect(function(p5)
					configureAnimationSet(p1, p2);
				end));
				u1[p1][v15] = {};
				u1[p1][v15].anim = v20;
				local l__Weight__21 = v20:FindFirstChild("Weight");
				if l__Weight__21 == nil then
					u1[p1][v15].weight = 1;
				else
					u1[p1][v15].weight = l__Weight__21.Value;
				end;
				u1[p1].count = u1[p1].count + 1;
				u1[p1].totalWeight = u1[p1].totalWeight + u1[p1][v15].weight;
				v15 = v15 + 1;
			end;		
		end;
	end;
	if u1[p1].count <= 0 then
		local v22, v23, v24 = pairs(p2);
		while true do
			local v25, v26 = v22(v23, v24);
			if v25 then

			else
				break;
			end;
			v24 = v25;
			u1[p1][v25] = {};
			u1[p1][v25].anim = Instance.new("Animation");
			u1[p1][v25].anim.Name = p1;
			u1[p1][v25].anim.AnimationId = v26.id;
			u1[p1][v25].weight = v26.weight;
			u1[p1].count = u1[p1].count + 1;
			u1[p1].totalWeight = u1[p1].totalWeight + v26.weight;		
		end;
	end;
end;
local u2 = {
	idle = { {
			id = "http://www.roblox.com/asset/?id=180435571", 
			weight = 9
		}, {
			id = "http://www.roblox.com/asset/?id=180435792", 
			weight = 1
		} }, 
	walk = { {
			id = "http://www.roblox.com/asset/?id=180426354", 
			weight = 10
		} }, 
	run = { {
			id = "run.xml", 
			weight = 10
		} }, 
	jump = { {
			id = "http://www.roblox.com/asset/?id=125750702", 
			weight = 10
		} }, 
	fall = { {
			id = "http://www.roblox.com/asset/?id=180436148", 
			weight = 10
		} }, 
	climb = { {
			id = "http://www.roblox.com/asset/?id=180436334", 
			weight = 10
		} }, 
	sit = { {
			id = "http://www.roblox.com/asset/?id=178130996", 
			weight = 10
		} }, 
	toolnone = { {
			id = "http://www.roblox.com/asset/?id=182393478", 
			weight = 10
		} }, 
	toolslash = { {
			id = "http://www.roblox.com/asset/?id=129967390", 
			weight = 10
		} }, 
	toollunge = { {
			id = "http://www.roblox.com/asset/?id=129967478", 
			weight = 10
		} }, 
	wave = { {
			id = "http://www.roblox.com/asset/?id=128777973", 
			weight = 10
		} }, 
	point = { {
			id = "http://www.roblox.com/asset/?id=128853357", 
			weight = 10
		} }, 
	dance1 = { {
			id = "http://www.roblox.com/asset/?id=182435998", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491037", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491065", 
			weight = 10
		} }, 
	dance2 = { {
			id = "http://www.roblox.com/asset/?id=182436842", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491248", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491277", 
			weight = 10
		} }, 
	dance3 = { {
			id = "http://www.roblox.com/asset/?id=182436935", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491368", 
			weight = 10
		}, {
			id = "http://www.roblox.com/asset/?id=182491423", 
			weight = 10
		} }, 
	cheer = { {
			id = "http://www.roblox.com/asset/?id=129423030", 
			weight = 10
		} }
};
function scriptChildModified(p6)
	local v27 = u2[p6.Name];
	if v27 ~= nil then
		configureAnimationSet(p6.Name, v27);
	end;
end;
script.ChildAdded:connect(scriptChildModified);
script.ChildRemoved:connect(scriptChildModified);
for v28, v29 in pairs(u2) do
	configureAnimationSet(v28, v29);
end;
local u3 = "";
local u4 = {
	wave = false, 
	point = false, 
	dance1 = true, 
	dance2 = true, 
	dance3 = true, 
	cheer = false
};
local u5 = nil;
local u6 = nil;
local u7 = nil;
function stopAllAnimations()
	local v30 = u3;
	if u4[v30] ~= nil then
		if u4[v30] == false then
			v30 = "idle";
		end;
	end;
	u3 = "";
	u5 = nil;
	if u6 ~= nil then
		u6:disconnect();
	end;
	if u7 ~= nil then
		u7:Stop();
		u7:Destroy();
		u7 = nil;
	end;
	return v30;
end;
local u8 = 1;
function setAnimationSpeed(p7)
	if p7 ~= u8 then
		u8 = p7;
		u7:AdjustSpeed(u8);
	end;
end;
function keyFrameReachedFunc(p8)
	if p8 == "End" then
		local v31 = u3;
		if u4[v31] ~= nil then
			if u4[v31] == false then
				v31 = "idle";
			end;
		end;
		playAnimation(v31, 0, l__Humanoid__8);
		setAnimationSpeed(u8);
	end;
end;
function playAnimation(p9, p10, p11)
	local v32 = math.random(1, u1[p9].totalWeight);
	local v33 = 1;
	while true do
		if u1[p9][v33].weight < v32 then

		else
			break;
		end;
		v32 = v32 - u1[p9][v33].weight;
		v33 = v33 + 1;	
	end;
	local l__anim__34 = u1[p9][v33].anim;
	if l__anim__34 ~= u5 then
		if u7 ~= nil then
			u7:Stop(p10);
			u7:Destroy();
		end;
		u8 = 1;
		u7 = p11:LoadAnimation(l__anim__34);
		u7.Priority = Enum.AnimationPriority.Core;
		u7:Play(p10);
		u3 = p9;
		u5 = l__anim__34;
		if u6 ~= nil then
			u6:disconnect();
		end;
		u6 = u7.KeyframeReached:connect(keyFrameReachedFunc);
	end;
end;
local u9 = "";
function toolKeyFrameReachedFunc(p12)
	if p12 == "End" then
		playToolAnimation(u9, 0, l__Humanoid__8);
	end;
end;
local u10 = nil;
local u11 = nil;
local u12 = nil;
function playToolAnimation(p13, p14, p15, p16)
	local v35 = math.random(1, u1[p13].totalWeight);
	local v36 = 1;
	while true do
		if u1[p13][v36].weight < v35 then

		else
			break;
		end;
		v35 = v35 - u1[p13][v36].weight;
		v36 = v36 + 1;	
	end;
	local l__anim__37 = u1[p13][v36].anim;
	if u10 ~= l__anim__37 then
		if u11 ~= nil then
			u11:Stop();
			u11:Destroy();
			p14 = 0;
		end;
		u11 = p15:LoadAnimation(l__anim__37);
		if p16 then
			u11.Priority = p16;
		end;
		u11:Play(p14);
		u9 = p13;
		u10 = l__anim__37;
		u12 = u11.KeyframeReached:connect(toolKeyFrameReachedFunc);
	end;
end;
function stopToolAnimations()
	if u12 ~= nil then
		u12:disconnect();
	end;
	u9 = "";
	u10 = nil;
	if u11 ~= nil then
		u11:Stop();
		u11:Destroy();
		u11 = nil;
	end;
	return u9;
end;
local u13 = "Standing";
function onRunning(p17)
	if 0.01 < p17 then

	else
		if u4[u3] == nil then
			playAnimation("idle", 0.1, l__Humanoid__8);
			u13 = "Standing";
		end;
		return;
	end;
	playAnimation("walk", 0.1, l__Humanoid__8);
	if u5 then
		if u5.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
			setAnimationSpeed(p17 / 14.5);
		end;
	end;
	u13 = "Running";
end;
function onDied()
	u13 = "Dead";
end;
local u14 = 0;
function onJumping()
	playAnimation("jump", 0.1, l__Humanoid__8);
	u14 = 0.3;
	u13 = "Jumping";
end;
function onClimbing(p18)
	playAnimation("climb", 0.1, l__Humanoid__8);
	setAnimationSpeed(p18 / 12);
	u13 = "Climbing";
end;
function onGettingUp()
	u13 = "GettingUp";
end;
function onFreeFall()
	if u14 <= 0 then
		playAnimation("fall", 0.3, l__Humanoid__8);
	end;
	u13 = "FreeFall";
end;
function onFallingDown()
	u13 = "FallingDown";
end;
function onSeated()
	u13 = "Seated";
end;
function onPlatformStanding()
	u13 = "PlatformStanding";
end;
function onSwimming(p19)
	if 0 < p19 then
		u13 = "Running";
		return;
	end;
	u13 = "Standing";
end;
function getTool()
	local v38, v39, v40 = ipairs(l__Parent__1:GetChildren());
	while true do
		local v41, v42 = v38(v39, v40);
		if v41 then

		else
			break;
		end;
		v40 = v41;
		if v42.className == "Tool" then
			return v42;
		end;	
	end;
	return nil;
end;
function getToolAnim(p20)
	local v43, v44, v45 = ipairs(p20:GetChildren());
	while true do
		local v46, v47 = v43(v44, v45);
		if v46 then

		else
			break;
		end;
		v45 = v46;
		if v47.Name == "toolanim" then
			if v47.className == "StringValue" then
				return v47;
			end;
		end;	
	end;
	return nil;
end;
local u15 = "None";
function animateTool()
	if u15 == "None" then
		playToolAnimation("toolnone", 0.1, l__Humanoid__8, Enum.AnimationPriority.Idle);
		return;
	end;
	if u15 == "Slash" then
		playToolAnimation("toolslash", 0, l__Humanoid__8, Enum.AnimationPriority.Action);
		return;
	end;
	if u15 == "Lunge" then

	else
		return;
	end;
	playToolAnimation("toollunge", 0, l__Humanoid__8, Enum.AnimationPriority.Action);
end;
function moveSit()
	l__Right_Shoulder__3.MaxVelocity = 0.15;
	l__Left_Shoulder__4.MaxVelocity = 0.15;
	l__Right_Shoulder__3:SetDesiredAngle(1.57);
	l__Left_Shoulder__4:SetDesiredAngle(-1.57);
	l__Right_Hip__5:SetDesiredAngle(1.57);
	l__Left_Hip__6:SetDesiredAngle(-1.57);
end;
local u16 = 0;
local u17 = 0;
function move(p21)
	local v48 = 1;
	local v49 = 1;
	u16 = p21;
	local v50 = false;
	if 0 < u14 then
		u14 = u14 - (p21 - u16);
	end;
	if u13 == "FreeFall" then
		if u14 <= 0 then
			playAnimation("fall", 0.3, l__Humanoid__8);
		else
			if u13 == "Seated" then
				playAnimation("sit", 0.5, l__Humanoid__8);
				return;
			end;
			if u13 == "Running" then
				playAnimation("walk", 0.1, l__Humanoid__8);
			elseif u13 ~= "Dead" then
				if u13 ~= "GettingUp" then
					if u13 ~= "FallingDown" then
						if u13 ~= "Seated" then
							if u13 == "PlatformStanding" then
								stopAllAnimations();
								v48 = 0.1;
								v49 = 1;
								v50 = true;
							end;
						else
							stopAllAnimations();
							v48 = 0.1;
							v49 = 1;
							v50 = true;
						end;
					else
						stopAllAnimations();
						v48 = 0.1;
						v49 = 1;
						v50 = true;
					end;
				else
					stopAllAnimations();
					v48 = 0.1;
					v49 = 1;
					v50 = true;
				end;
			else
				stopAllAnimations();
				v48 = 0.1;
				v49 = 1;
				v50 = true;
			end;
		end;
	else
		if u13 == "Seated" then
			playAnimation("sit", 0.5, l__Humanoid__8);
			return;
		end;
		if u13 == "Running" then
			playAnimation("walk", 0.1, l__Humanoid__8);
		elseif u13 ~= "Dead" then
			if u13 ~= "GettingUp" then
				if u13 ~= "FallingDown" then
					if u13 ~= "Seated" then
						if u13 == "PlatformStanding" then
							stopAllAnimations();
							v48 = 0.1;
							v49 = 1;
							v50 = true;
						end;
					else
						stopAllAnimations();
						v48 = 0.1;
						v49 = 1;
						v50 = true;
					end;
				else
					stopAllAnimations();
					v48 = 0.1;
					v49 = 1;
					v50 = true;
				end;
			else
				stopAllAnimations();
				v48 = 0.1;
				v49 = 1;
				v50 = true;
			end;
		else
			stopAllAnimations();
			v48 = 0.1;
			v49 = 1;
			v50 = true;
		end;
	end;
	if v50 then
		local v51 = v48 * math.sin(p21 * v49);
		l__Right_Shoulder__3:SetDesiredAngle(v51 + 0);
		l__Left_Shoulder__4:SetDesiredAngle(v51 - 0);
		l__Right_Hip__5:SetDesiredAngle(-v51);
		l__Left_Hip__6:SetDesiredAngle(-v51);
	end;
	local v52 = getTool();
	if v52 then
		if v52:FindFirstChild("Handle") then

		else
			stopToolAnimations();
			u15 = "None";
			u10 = nil;
			u17 = 0;
			return;
		end;
	else
		stopToolAnimations();
		u15 = "None";
		u10 = nil;
		u17 = 0;
		return;
	end;
	local v53 = getToolAnim(v52);
	if v53 then
		u15 = v53.Value;
		v53.Parent = nil;
		u17 = p21 + 0.3;
	end;
	if u17 < p21 then
		u17 = 0;
		u15 = "None";
	end;
	animateTool();
end;
l__Humanoid__8.Died:connect(onDied);
l__Humanoid__8.Running:connect(onRunning);
l__Humanoid__8.Jumping:connect(onJumping);
l__Humanoid__8.Climbing:connect(onClimbing);
l__Humanoid__8.GettingUp:connect(onGettingUp);
l__Humanoid__8.FreeFalling:connect(onFreeFall);
l__Humanoid__8.FallingDown:connect(onFallingDown);
l__Humanoid__8.Seated:connect(onSeated);
l__Humanoid__8.PlatformStanding:connect(onPlatformStanding);
l__Humanoid__8.Swimming:connect(onSwimming);
local u18 = { "dance1", "dance2", "dance3" };
game:GetService("Players").LocalPlayer.Chatted:connect(function(p22)
	local v54 = "";
	if p22 == "/e dance" then
		v54 = u18[math.random(1, #u18)];
	elseif string.sub(p22, 1, 3) == "/e " then
		v54 = string.sub(p22, 4);
	elseif string.sub(p22, 1, 7) == "/emote " then
		v54 = string.sub(p22, 8);
	end;
	if u13 == "Standing" and u4[v54] ~= nil then
		playAnimation(v54, 0.1, l__Humanoid__8);
	end;
end);
playAnimation("idle", 0.1, l__Humanoid__8);
u13 = "Standing";
while l__Parent__1.Parent ~= nil do
	local v55, v56 = wait(0.1);
	move(v56);
end;
