local j=myHead.Running local T=myHead.Jumping local b=myHead.Hurt local B=myHead.Died myHuman:SetStateEnabled(Enum.HumanoidStateType.Flying,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.Physics,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics,false)myHuman:SetStateEnabled(Enum.HumanoidStateType.Swimming,false)local s=Instance.new("\065\116\116\097\099\104\109\101\110\116")s.Parent=workspace.Terrain myHuman.Running:Connect(function(T)if T>0 then j:Play()else j:Stop()end end)myHuman.Jumping:Connect(function()T:Play()end)if marine.Settings.PlayDeathAnimation.Value==true then myHuman.BreakJointsOnDeath=false end myHuman.Died:Connect(function()B:Play()actions.yieldM4()actions.updateFace("\068\101\097\100")if marine.Settings.PlayDeathAnimation.Value==true then myHuman.BreakJointsOnDeath=false marine.HumanoidRootPart.Anchored=true DeathAnimation:Play()DeathAnimation.Stopped:Wait()end for j,T in ipairs(marine:GetDescendants())do if T:IsA("\066\097\108\108\083\111\099\107\101\116\067\111\110\115\116\114\097\105\110\116")then T.Enabled=true elseif T:IsA("\066\097\115\101\080\097\114\116")and T.Name~="\109\121\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116"then T.CanCollide=false elseif T:IsA("\077\111\116\111\114\054\068")then T:Destroy()end end if marine.Settings.Respawn.Value then wait(marine.Settings.RespawnDelay.Value)clone.Parent=marine.Parent ArmorDurability=MaxArmorDurability end for j,T in ipairs(marine:GetDescendants())do if T:IsA("\066\097\115\101\080\097\114\116")or T:IsA("\068\101\099\097\108")then((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(T,TweenInfo.new(.2),{Transparency=1})):Play()end end s:Destroy()wait(.2)marine:Destroy()end)local Y={.9,.95,1,1.05,1.1}myHuman.HealthChanged:Connect(function(j)if ArmorDurability>0 then local T=oldHealth-j if ArmorDurability-T<=0 then ArmorDurability=0 marine.Torso.ArmorBroken:Play()local j=TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)local T={BackgroundTransparency=1}local b={ImageTransparency=1}ArmorFill.Size=UDim2.new(0,0,1,0)for B,s in pairs(ArmorGUI:GetDescendants())do if s:IsA("\070\114\097\109\101")then local b=TweenService:Create(s,j,T)b:Play()elseif s:IsA("\073\109\097\103\101\076\097\098\101\108")then local T=TweenService:Create(s,j,b)T:Play()end end else ArmorDurability-=T ArmorFill.Size=UDim2.new((ArmorDurability/MaxArmorDurability)*1,0,1,0)myHuman.Health=oldHealth end end if j<oldHealth and b.IsPlaying==false then status:set("\116\111\111\107\068\097\109\097\103\101",true)if math.random(3)==1 then b.PlaybackSpeed=Y[math.random(#Y)]b:Play()end core.spawn(function()actions.updateFace("\072\117\114\116")wait(1)if myHead:FindFirstChild("\102\097\099\101\072\117\114\116")then actions.updateFace(status:get("\109\111\111\100"),true)end end)end oldHealth=myHuman.Health if myHuman.Health<=0 then combatModule.destroyBulletRelatedCopies()local j=TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)local T={BackgroundTransparency=1}local b={ImageTransparency=1}HealthFill.Size=UDim2.new(0,0,1,0)for B,s in pairs(HealthGUI:GetDescendants())do if s:IsA("\070\114\097\109\101")then local b=TweenService:Create(s,j,T)b:Play()elseif s:IsA("\073\109\097\103\101\076\097\098\101\108")then local T=TweenService:Create(s,j,b)T:Play()end end else HealthFill.Size=UDim2.new((myHuman.Health/myHuman.MaxHealth)*1,0,1,0)if myHuman.Health<45 then for j,T in pairs(HealthFrame:GetChildren())do if T.Name=="\066\111\114\100\101\114\115"then T.BackgroundColor3=Color3.fromRGB(189,63,63)end end HealthBar.BorderColor3=Color3.fromRGB(189,63,63)HealthFill.BackgroundColor3=Color3.fromRGB(189,63,63)HealthShading.BackgroundColor3=Color3.fromRGB(194,87,87)HealthFrame.ImageLabel.ImageColor3=Color3.fromRGB(189,63,63)else for j,T in pairs(HealthFrame:GetChildren())do if T.Name=="\066\111\114\100\101\114\115"then T.BackgroundColor3=Color3.fromRGB(0,189,0)end end HealthBar.BorderColor3=Color3.fromRGB(0,189,0)HealthFill.BackgroundColor3=Color3.fromRGB(0,189,0)HealthShading.BackgroundColor3=Color3.fromRGB(115,189,102)HealthFrame.ImageLabel.ImageColor3=Color3.fromRGB(0,189,0)end end end)

local runningSound = myHead.Running
local jumpingSound = myHead.Jumping
local hurtSound = myHead.Hurt
local diedSound = myHead.Died

myHuman:SetStateEnabled(Enum.HumanoidStateType.Flying,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Physics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Ragdoll,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics,false)
myHuman:SetStateEnabled(Enum.HumanoidStateType.Swimming,false)

local rotAttach1 = Instance.new("Attachment")
rotAttach1.Parent = workspace.Terrain

myHuman.Running:Connect(function(speed)
	if speed>0 then
		runningSound:Play()
	else
		runningSound:Stop()
	end
end)

myHuman.Jumping:Connect(function()
	jumpingSound:Play()
end)

if marine.Settings.PlayDeathAnimation.Value == true then
	myHuman.BreakJointsOnDeath = false
end

myHuman.Died:Connect(function()
	diedSound:Play()
	actions.yieldM4()
	actions.updateFace("Dead")
	if marine.Settings.PlayDeathAnimation.Value == true then
		myHuman.BreakJointsOnDeath = false
		marine.HumanoidRootPart.Anchored = true
		DeathAnimation:Play()
		DeathAnimation.Stopped:Wait()
	end
	for i,v in ipairs(marine:GetDescendants()) do
		if v:IsA("BallSocketConstraint") then
			v.Enabled = true
		elseif v:IsA("BasePart") and v.Name ~= "myHumanoidRootPart" then
			v.CanCollide = false
		elseif v:IsA("Motor6D") then
			v:Destroy()
		end
	end
	if marine.Settings.Respawn.Value then
		wait(marine.Settings.RespawnDelay.Value)
		clone.Parent = marine.Parent
		ArmorDurability = MaxArmorDurability
	end
	for i,v in ipairs(marine:GetDescendants()) do
		if v:IsA("BasePart") or v:IsA("Decal") then
			game:GetService("TweenService"):Create(v,TweenInfo.new(0.2),{Transparency = 1}):Play()
		end
	end
	rotAttach1:Destroy()
	wait(0.2)
	marine:Destroy()
end)

local soundSpeeds = {0.9,0.95,1,1.05,1.1}
myHuman.HealthChanged:Connect(function(health)
	if ArmorDurability > 0 then
		local damageTaken = oldHealth - health
		
		if (ArmorDurability - damageTaken) <= 0 then
			ArmorDurability = 0
			marine.Torso.ArmorBroken:Play()
			
			local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
			local Properties1 = {BackgroundTransparency = 1}
			local Properties2 = {ImageTransparency = 1}
			
			ArmorFill.Size = UDim2.new(0, 0, 1, 0)
			
			for i,v in pairs(ArmorGUI:GetDescendants()) do
				if v:IsA("Frame") then
					local Tween = TweenService:Create(v,Info,Properties1)
					
					Tween:Play()
				elseif v:IsA("ImageLabel") then
					local Tween = TweenService:Create(v,Info,Properties2)
					
					Tween:Play()
				end
			end
		else
			ArmorDurability -= damageTaken
			
			ArmorFill.Size = UDim2.new((ArmorDurability / MaxArmorDurability) * 1, 0, 1, 0)
			
			myHuman.Health = oldHealth
		end
	end
	
	if health < oldHealth and hurtSound.IsPlaying == false then
		status:set("tookDamage",true)
		if math.random(3) == 1 then
			hurtSound.PlaybackSpeed = soundSpeeds[math.random(#soundSpeeds)]
			hurtSound:Play()
		end
		core.spawn(function()
			actions.updateFace("Hurt")
			wait(1)
			if myHead:FindFirstChild("faceHurt") then
				actions.updateFace(status:get("mood"),true)
			end
		end)
	end
	
	oldHealth = myHuman.Health
	
	if myHuman.Health <= 0 then
		combatModule.destroyBulletRelatedCopies()
		
		local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
		local Properties1 = {BackgroundTransparency = 1}
		local Properties2 = {ImageTransparency = 1}

		HealthFill.Size = UDim2.new(0, 0, 1, 0)

		for i,v in pairs(HealthGUI:GetDescendants()) do
			if v:IsA("Frame") then
				local Tween = TweenService:Create(v,Info,Properties1)

				Tween:Play()
			elseif v:IsA("ImageLabel") then
				local Tween = TweenService:Create(v,Info,Properties2)

				Tween:Play()
			end
		end
	else
		HealthFill.Size = UDim2.new((myHuman.Health / myHuman.MaxHealth) * 1, 0, 1, 0)
		
		if myHuman.Health < 45 then
			for i,v in pairs(HealthFrame:GetChildren()) do
				if v.Name == "Borders" then
					v.BackgroundColor3 = Color3.fromRGB(189, 63, 63)
				end
			end
			
			HealthBar.BorderColor3 = Color3.fromRGB(189, 63, 63)
			HealthFill.BackgroundColor3 = Color3.fromRGB(189, 63, 63)
			HealthShading.BackgroundColor3 = Color3.fromRGB(194, 87, 87)
			
			HealthFrame.ImageLabel.ImageColor3 = Color3.fromRGB(189, 63, 63)
		else
			for i,v in pairs(HealthFrame:GetChildren()) do
				if v.Name == "Borders" then
					v.BackgroundColor3 = Color3.fromRGB(0, 189, 0)
				end
			end

			HealthBar.BorderColor3 = Color3.fromRGB(0, 189, 0)
			HealthFill.BackgroundColor3 = Color3.fromRGB(0, 189, 0)
			HealthShading.BackgroundColor3 = Color3.fromRGB(115, 189, 102)

			HealthFrame.ImageLabel.ImageColor3 = Color3.fromRGB(0, 189, 0)
		end
	end
end)
