function ArmorModule.GetLevel(h)if game.ReplicatedStorage.ARMORS:FindFirstChild(h)~=nil then return(game.ReplicatedStorage.ARMORS:FindFirstChild(h)).Level.Value else return 0 end end function ArmorModule.GetDefense(h)if game.ReplicatedStorage.ARMORS:FindFirstChild(h)~=nil then if game.Workspace.GAME_PROPERTIES.DefenseMode.Value==1 or game.Workspace.GAME_PROPERTIES.DefenseMode.Value==2 then return(game.ReplicatedStorage.ARMORS:FindFirstChild(h)).Defense.Value elseif game.Workspace.GAME_PROPERTIES.DefenseMode.Value==3 then return(game.ReplicatedStorage.ARMORS:FindFirstChild(h)).HPBoost.Value else return 0 end else return 0 end end function ArmorModule.RemoveArmor(h)local f=h:FindFirstChild("\072\117\109\097\110\111\105\100")or h:FindFirstChild("\072\117\109\097\110")if f~=nil then if h:FindFirstChild("\065\114\109\049")~=nil then(h:FindFirstChild("\065\114\109\049")):Remove()end if h:FindFirstChild("\065\114\109\050")~=nil then(h:FindFirstChild("\065\114\109\050")):Remove()end if h:FindFirstChild("\076\101\103\049")~=nil then(h:FindFirstChild("\076\101\103\049")):Remove()end if h:FindFirstChild("\076\101\103\050")~=nil then(h:FindFirstChild("\076\101\103\050")):Remove()end if h:FindFirstChild("\067\104\101\115\116")~=nil then(h:FindFirstChild("\067\104\101\115\116")):Remove()end else return false end end function ArmorModule.EquipArmor(h,f)local j=h:FindFirstChild("\072\117\109\097\110\111\105\100")or h:FindFirstChild("\072\117\109\097\110")if h~=nil then if j~=nil then if h:FindFirstChild("\065\114\109\049")~=nil then(h:FindFirstChild("\065\114\109\049")):Remove()end if h:FindFirstChild("\065\114\109\050")~=nil then(h:FindFirstChild("\065\114\109\050")):Remove()end if h:FindFirstChild("\076\101\103\049")~=nil then(h:FindFirstChild("\076\101\103\049")):Remove()end if h:FindFirstChild("\076\101\103\050")~=nil then(h:FindFirstChild("\076\101\103\050")):Remove()end if h:FindFirstChild("\067\104\101\115\116")~=nil then(h:FindFirstChild("\067\104\101\115\116")):Remove()end end else return false end if j~=nil and h:FindFirstChild("\065\114\109\049")==nil then local j=(game.ReplicatedStorage.ARMORS:FindFirstChild(f)).Arm1:Clone()j.Parent=h local H=j:GetChildren()for f=1,#H,1 do if H[f].ClassName=="\080\097\114\116"then if H[f].Name=="\077\105\100\100\108\101"then H[f].Transparency=1 end local h=Instance.new("\087\101\108\100")h.Part0=j.Middle h.Part1=H[f]local B=CFrame.new(j.Middle.Position)local u=j.Middle.CFrame:inverse()*B local F=H[f].CFrame:inverse()*B h.C0=u h.C1=F h.Parent=j.Middle end local B=Instance.new("\087\101\108\100")B.Part0=h["\076\101\102\116 \065\114\109"]B.Part1=j.Middle B.C0=CFrame.new(0,0,0)B.Parent=B.Part0 end local B=j:GetChildren()for h=1,#B,1 do B[h].Anchored=false B[h].CanCollide=false end end if j~=nil and h:FindFirstChild("\065\114\109\050")==nil then local j=(game.ReplicatedStorage.ARMORS:FindFirstChild(f)).Arm2:Clone()j.Parent=h local H=j:GetChildren()for f=1,#H,1 do if H[f].ClassName=="\080\097\114\116"then if H[f].Name=="\077\105\100\100\108\101"then H[f].Transparency=1 end local h=Instance.new("\087\101\108\100")h.Part0=j.Middle h.Part1=H[f]local B=CFrame.new(j.Middle.Position)local u=j.Middle.CFrame:inverse()*B local F=H[f].CFrame:inverse()*B h.C0=u h.C1=F h.Parent=j.Middle end local B=Instance.new("\087\101\108\100")B.Part0=h["\082\105\103\104\116 \065\114\109"]B.Part1=j.Middle B.C0=CFrame.new(0,0,0)B.Parent=B.Part0 end local B=j:GetChildren()for h=1,#B,1 do B[h].Anchored=false B[h].CanCollide=false end end if j~=nil and h:FindFirstChild("\076\101\103\049")==nil then local j=(game.ReplicatedStorage.ARMORS:FindFirstChild(f)).Leg1:Clone()j.Parent=h local H=j:GetChildren()for f=1,#H,1 do if H[f].ClassName=="\080\097\114\116"then if H[f].Name=="\077\105\100\100\108\101"then H[f].Transparency=1 end local h=Instance.new("\087\101\108\100")h.Part0=j.Middle h.Part1=H[f]local B=CFrame.new(j.Middle.Position)local u=j.Middle.CFrame:inverse()*B local F=H[f].CFrame:inverse()*B h.C0=u h.C1=F h.Parent=j.Middle end local B=Instance.new("\087\101\108\100")B.Part0=h["\076\101\102\116 \076\101\103"]B.Part1=j.Middle B.C0=CFrame.new(0,0,0)B.Parent=B.Part0 end local B=j:GetChildren()for h=1,#B,1 do B[h].Anchored=false B[h].CanCollide=false end end if j~=nil and h:FindFirstChild("\076\101\103\050")==nil then local j=(game.ReplicatedStorage.ARMORS:FindFirstChild(f)).Leg2:Clone()j.Parent=h local H=j:GetChildren()for f=1,#H,1 do if H[f].ClassName=="\080\097\114\116"then if H[f].Name=="\077\105\100\100\108\101"then H[f].Transparency=1 end local h=Instance.new("\087\101\108\100")h.Part0=j.Middle h.Part1=H[f]local B=CFrame.new(j.Middle.Position)local u=j.Middle.CFrame:inverse()*B local F=H[f].CFrame:inverse()*B h.C0=u h.C1=F h.Parent=j.Middle end local B=Instance.new("\087\101\108\100")B.Part0=h["\082\105\103\104\116 \076\101\103"]B.Part1=j.Middle B.C0=CFrame.new(0,0,0)B.Parent=B.Part0 end local B=j:GetChildren()for h=1,#B,1 do B[h].Anchored=false B[h].CanCollide=false end end if j~=nil and h:FindFirstChild("\067\104\101\115\116")==nil then local j=(game.ReplicatedStorage.ARMORS:FindFirstChild(f)).Chest:Clone()j.Parent=h local H=j:GetChildren()for f=1,#H,1 do if H[f].ClassName=="\080\097\114\116"then if H[f].Name=="\077\105\100\100\108\101"then H[f].Transparency=1 end local h=Instance.new("\087\101\108\100")h.Part0=j.Middle h.Part1=H[f]local B=CFrame.new(j.Middle.Position)local u=j.Middle.CFrame:inverse()*B local F=H[f].CFrame:inverse()*B h.C0=u h.C1=F h.Parent=j.Middle end local B=Instance.new("\087\101\108\100")B.Part0=h.Torso B.Part1=j.Middle B.C0=CFrame.new(0,0,0)B.Parent=B.Part0 end local B=j:GetChildren()for h=1,#B,1 do B[h].Anchored=false B[h].CanCollide=false end end end return ArmorModule
--This script exists to let you add armor to mobs and also, to auto re-equip armor on respawn.
function ArmorModule.GetLevel(armor)
	if game.ReplicatedStorage.ARMORS:FindFirstChild(armor) ~= nil then
		return game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Level.Value
	else
		return 0 --If it's not found, returns 0.
	end
end

function ArmorModule.GetDefense(armor)
	if game.ReplicatedStorage.ARMORS:FindFirstChild(armor) ~= nil then
		if
			game.Workspace.GAME_PROPERTIES.DefenseMode.Value == 1
			or game.Workspace.GAME_PROPERTIES.DefenseMode.Value == 2
		then
			return game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Defense.Value
		elseif game.Workspace.GAME_PROPERTIES.DefenseMode.Value == 3 then
			return game.ReplicatedStorage.ARMORS:FindFirstChild(armor).HPBoost.Value
		else
			return 0
		end
	else
		return 0 --If the armor is not found, returns 0.
	end
end

function ArmorModule.RemoveArmor(character)
	local humanoid = character:FindFirstChild("Humanoid") or character:FindFirstChild("Human")
	--Remove old armour.
	if humanoid ~= nil then
		if character:FindFirstChild("Arm1") ~= nil then
			character:FindFirstChild("Arm1"):Remove()
		end
		if character:FindFirstChild("Arm2") ~= nil then
			character:FindFirstChild("Arm2"):Remove()
		end
		if character:FindFirstChild("Leg1") ~= nil then
			character:FindFirstChild("Leg1"):Remove()
		end
		if character:FindFirstChild("Leg2") ~= nil then
			character:FindFirstChild("Leg2"):Remove()
		end
		if character:FindFirstChild("Chest") ~= nil then
			character:FindFirstChild("Chest"):Remove()
		end
	else
		return false --Exits the function if it's nil. Prevents the function from breaking.
	end
end

function ArmorModule.EquipArmor(character, armor)
	local humanoid = character:FindFirstChild("Humanoid") or character:FindFirstChild("Human")
	if character ~= nil then
		--Remove old armour.
		if humanoid ~= nil then
			if character:FindFirstChild("Arm1") ~= nil then
				character:FindFirstChild("Arm1"):Remove()
			end
			if character:FindFirstChild("Arm2") ~= nil then
				character:FindFirstChild("Arm2"):Remove()
			end
			if character:FindFirstChild("Leg1") ~= nil then
				character:FindFirstChild("Leg1"):Remove()
			end
			if character:FindFirstChild("Leg2") ~= nil then
				character:FindFirstChild("Leg2"):Remove()
			end
			if character:FindFirstChild("Chest") ~= nil then
				character:FindFirstChild("Chest"):Remove()
			end
		end
	else
		return false --Exits the function if it's nil. Prevents the function from breaking.
	end
	--Arms
	if humanoid ~= nil and character:FindFirstChild("Arm1") == nil then
		local g = game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Arm1:Clone()
		g.Parent = character
		local C = g:GetChildren()
		for i = 1, #C do
			if C[i].ClassName == "Part" then
				if C[i].Name == "Middle" then
					C[i].Transparency = 1
				end
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse() * CJ
				local C1 = C[i].CFrame:inverse() * CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
			local Y = Instance.new("Weld")
			Y.Part0 = character["Left Arm"]
			Y.Part1 = g.Middle
			Y.C0 = CFrame.new(0, 0, 0)
			Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, #h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end

	if humanoid ~= nil and character:FindFirstChild("Arm2") == nil then
		local g = game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Arm2:Clone()
		g.Parent = character
		local C = g:GetChildren()
		for i = 1, #C do
			if C[i].ClassName == "Part" then
				if C[i].Name == "Middle" then
					C[i].Transparency = 1
				end
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse() * CJ
				local C1 = C[i].CFrame:inverse() * CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
			local Y = Instance.new("Weld")
			Y.Part0 = character["Right Arm"]
			Y.Part1 = g.Middle
			Y.C0 = CFrame.new(0, 0, 0)
			Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, #h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end
	--Legs
	if humanoid ~= nil and character:FindFirstChild("Leg1") == nil then
		local g = game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Leg1:Clone()
		g.Parent = character
		local C = g:GetChildren()
		for i = 1, #C do
			if C[i].ClassName == "Part" then
				if C[i].Name == "Middle" then
					C[i].Transparency = 1
				end
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse() * CJ
				local C1 = C[i].CFrame:inverse() * CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
			local Y = Instance.new("Weld")
			Y.Part0 = character["Left Leg"]
			Y.Part1 = g.Middle
			Y.C0 = CFrame.new(0, 0, 0)
			Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, #h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end

	if humanoid ~= nil and character:FindFirstChild("Leg2") == nil then
		local g = game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Leg2:Clone()
		g.Parent = character
		local C = g:GetChildren()
		for i = 1, #C do
			if C[i].ClassName == "Part" then
				if C[i].Name == "Middle" then
					C[i].Transparency = 1
				end
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse() * CJ
				local C1 = C[i].CFrame:inverse() * CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
			local Y = Instance.new("Weld")
			Y.Part0 = character["Right Leg"]
			Y.Part1 = g.Middle
			Y.C0 = CFrame.new(0, 0, 0)
			Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, #h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end
	--Torso
	if humanoid ~= nil and character:FindFirstChild("Chest") == nil then
		local g = game.ReplicatedStorage.ARMORS:FindFirstChild(armor).Chest:Clone()
		g.Parent = character
		local C = g:GetChildren()
		for i = 1, #C do
			if C[i].ClassName == "Part" then
				if C[i].Name == "Middle" then
					C[i].Transparency = 1
				end
				local W = Instance.new("Weld")
				W.Part0 = g.Middle
				W.Part1 = C[i]
				local CJ = CFrame.new(g.Middle.Position)
				local C0 = g.Middle.CFrame:inverse() * CJ
				local C1 = C[i].CFrame:inverse() * CJ
				W.C0 = C0
				W.C1 = C1
				W.Parent = g.Middle
			end
			local Y = Instance.new("Weld")
			Y.Part0 = character.Torso
			Y.Part1 = g.Middle
			Y.C0 = CFrame.new(0, 0, 0)
			Y.Parent = Y.Part0
		end

		local h = g:GetChildren()
		for i = 1, #h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end
end

return ArmorModule
