function ray(y,u,l)local D=(l*CFrame.new(0,0,3)).p local M=(l*CFrame.Angles(0,0,math.rad(y)))*CFrame.new(u,0,-6)local t=Ray.new(D,(M-D).p)local o,K=game.Workspace:FindPartOnRayWithIgnoreList(t,ignoreList)if makeRays then local y=(K-D).magnitude makeRay(CFrame.new(D,M.p)*CFrame.new(0,0,-y/2),Vector3.new(.2,.2,y))end if not o then return end if o.Name=="\070\097\107\101\084\114\097\099\107"then ignoreList[#ignoreList+1]=o ray(y,u,l)return end if not o.Parent then return end local V=o.Parent:findFirstChild("\072\117\109\097\110\111\105\100")local U=game.Players:findFirstChild(o.Parent.Name)if V and U then if U.TeamColor~=BrickColor.new("\069\097\114\116\104 \103\114\101\101\110")then V:takeDamage(6000)end end if o.Parent.Name=="\080\097\114\116\115"then return end if o.Parent.Parent then tank=o.Parent.Parent:findFirstChild("\084\097\110\107")if not tank and o.Parent.Parent.Parent then tank=o.Parent.Parent.Parent:findFirstChild("\084\097\110\107")end end if not tank or tank==parts.Parent.Parent.Tank then return end local J=o.Parent:findFirstChild("\068\097\109\097\103\101")if J then if J.Value=="\066\097\114\114\101\108"and(not tank.Parent.GunDamaged.Value and math.random(1,8)==1)then tank.Parent.GunDamaged.Value=true print("\068\097\109\097\103\101\100 \066\097\114\114\101\108")elseif J.Value=="\076\084\114\097\099\107"and(not tank.Parent.LTrack.Value and math.random(1,8)==1)then tank.Parent.LTrack.Value=true print("\068\097\109\097\103\101\100 \076\101\102\116 \084\114\097\099\107")local y=o.Parent:getChildren()local u=math.random(1,2)for l=1,#y,1 do if y[l].Name=="\116\114\097\099\107\068\097\109\097\103\101"..u then y[l].Transparency=1 end end elseif J.Value=="\082\084\114\097\099\107"and(not tank.Parent.RTrack.Value and math.random(1,8)==1)then tank.Parent.RTrack.Value=true print("\068\097\109\097\103\101\100 \082\105\103\104\116 \084\114\097\099\107")local y=o.Parent:getChildren()local u=math.random(1,2)for l=1,#y,1 do if y[l].Name=="\116\114\097\099\107\068\097\109\097\103\101"..u then y[l].Transparency=1 end end end elseif o.Name=="\070\117\101\108"then tank.Value=BrickColor.new("\066\108\097\099\107")else local y=o:findFirstChild("\068\097\109\097\103\101")if not y then y=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")y.Parent=o y.Name="\068\097\109\097\103\101"local u=(o.Size.X*o.Size.Y)*o.Size.Z y.Value=u*o.Parent.ArmourValue.Value end y.Value=y.Value-dealingDamage if y.Value<=0 then if math.random(1,2)==1 then o:BreakJoints()else o:remove()end end end end round=Instance.new("\080\097\114\116",user)round.Name="\082\097\121\080\097\114\116"round.Material="\078\101\111\110"round.Transparency=.5 round.Anchored=true round.CanCollide=false round.TopSurface=Enum.SurfaceType.Smooth round.BottomSurface=Enum.SurfaceType.Smooth round.formFactor=Enum.FormFactor.Custom round.BrickColor=BrickColor.new("\078\101\119 \089\101\108\108\101\114")yOffset=-0.2
--Function For Making Rays Which Kills Bricks
function ray(angle, radius, orig)
	----------------SET POSITIONS
	local startPos = (orig * CFrame.new(0, 0, 3)).p
	local secondPos = orig * CFrame.Angles(0, 0, math.rad(angle)) * CFrame.new(radius, 0, -6)

	----------------MAKE RAY
	local damageRay = Ray.new(startPos, (secondPos - startPos).p)
	local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(damageRay, ignoreList)
	--if hit then print("Hit: "..hit.Name) else print("Hit: nil") end

	----------------DRAW RAY
	if makeRays then
		local distance = (position - startPos).magnitude
		makeRay(CFrame.new(startPos, secondPos.p) * CFrame.new(0, 0, -distance / 2), Vector3.new(0.2, 0.2, distance))
	end

	if not hit then
		return
	end
	if hit.Name == "FakeTrack" then
		ignoreList[#ignoreList + 1] = hit
		ray(angle, radius, orig)
		return
	end
	if not hit.Parent then
		return
	end
	local human = hit.Parent:findFirstChild("Humanoid")
	local player = game.Players:findFirstChild(hit.Parent.Name)
	if human and player then
		if player.TeamColor ~= BrickColor.new("Earth green") then
			human:takeDamage(6000)
		end
	end

	if hit.Parent.Name == "Parts" then
		return
	end

	if hit.Parent.Parent then --look if what we hit is a tank
		tank = hit.Parent.Parent:findFirstChild("Tank")

		if not tank and hit.Parent.Parent.Parent then
			tank = hit.Parent.Parent.Parent:findFirstChild("Tank")
		end
	end

	if not tank or tank == parts.Parent.Parent.Tank then
		return
	end
	----------------IF ITS A DAMAGEABLE PART
	local damagable = hit.Parent:findFirstChild("Damage")
	if damagable then
		if damagable.Value == "Barrel" and not tank.Parent.GunDamaged.Value and math.random(1, 8) == 1 then
			tank.Parent.GunDamaged.Value = true
			print("Damaged Barrel")
		elseif damagable.Value == "LTrack" and not tank.Parent.LTrack.Value and math.random(1, 8) == 1 then
			tank.Parent.LTrack.Value = true
			print("Damaged Left Track")

			local list = hit.Parent:getChildren()
			local randSide = math.random(1, 2)
			for i = 1, #list do
				if list[i].Name == ("trackDamage" .. randSide) then
					list[i].Transparency = 1
				end
			end
		elseif damagable.Value == "RTrack" and not tank.Parent.RTrack.Value and math.random(1, 8) == 1 then
			tank.Parent.RTrack.Value = true
			print("Damaged Right Track")

			local list = hit.Parent:getChildren()
			local randSide = math.random(1, 2)
			for i = 1, #list do
				if list[i].Name == ("trackDamage" .. randSide) then
					list[i].Transparency = 1
				end
			end
		end
	elseif hit.Name == "Fuel" then --if we hit their weak point
		tank.Value = BrickColor.new("Black")
	else
		local damage = hit:findFirstChild("Damage") --Check if There's a Damage Value Already in the Brick
		if not damage then
			damage = Instance.new("NumberValue")
			damage.Parent = hit
			damage.Name = "Damage"
			local volume = hit.Size.X * hit.Size.Y * hit.Size.Z
			damage.Value = volume * hit.Parent.ArmourValue.Value
		end
		damage.Value = damage.Value - dealingDamage
		if damage.Value <= 0 then
			if math.random(1, 2) == 1 then
				hit:BreakJoints()
			else
				hit:remove()
			end
		end
	end
end

round = Instance.new("Part", user)
round.Name = "RayPart"
round.Material = "Neon"
round.Transparency = 0.5
round.Anchored = true
round.CanCollide = false
round.TopSurface = Enum.SurfaceType.Smooth
round.BottomSurface = Enum.SurfaceType.Smooth
round.formFactor = Enum.FormFactor.Custom
round.BrickColor = BrickColor.new("New Yeller")
yOffset = -0.2
