local N=false function getPlayer(N)local V=game.Players:children()for A=1,#V,1 do if V[A].Character~=nil then if V[A].Character.Humanoid==N then return V[A]end end end return nil end function putOnArmor(N)local V=N.Parent.Torso V.Reflectance=.6 N.MaxHealth=200 local A=getPlayer(N)if A~=nil then local N=Instance.new("\077\101\115\115\097\103\101")N.Text="\089\111\117 \102\111\117\110\100 \066\097\116\116\108\101 \065\114\109\111\114\033"N.Parent=A wait(5)N.Text="\077\097\120 \072\101\097\108\116\104 \068\111\117\098\108\101\100\033"wait(5)N.Parent=nil end end function hasArmor(N)return N.MaxHealth>100 end function onTouched(V)local A=V.Parent:findFirstChild("\072\117\109\097\110\111\105\100")if A~=nil and N==false then if hasArmor(A)then return end N=true script.Parent.Parent=nil putOnArmor(A)N=false end end script.Parent.Touched:connect(onTouched)


local debounce = false

function getPlayer(humanoid)
	-- find the owning player of a humanoid.
	local players = game.Players:children()
	for i = 1, #players do
		if players[i].Character ~= nil then
			if players[i].Character.Humanoid == humanoid then return players[i] end
		end
	end
	return nil
end


function putOnArmor(humanoid)

	local torso = humanoid.Parent.Torso

	torso.Reflectance = .6
	humanoid.MaxHealth = 200
	
	
	local player = getPlayer(humanoid)
	if player ~= nil then
		local message = Instance.new("Message")
		message.Text = "You found Battle Armor!"
		message.Parent = player
		wait(5)
		message.Text = "Max Health Doubled!"
		wait(5)
		message.Parent = nil
	end


end

function hasArmor(humanoid)
	return (humanoid.MaxHealth > 100)
end

function onTouched(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	if humanoid~=nil and debounce == false then
		if (hasArmor(humanoid)) then return end
		debounce = true
		script.Parent.Parent = nil
		putOnArmor(humanoid)
		debounce = false
	end
end


script.Parent.Touched:connect(onTouched)
