function ray(G,t,q)local U=(q*CFrame.new(0,0,3)).p local O=(q*CFrame.Angles(0,0,math.rad(G)))*CFrame.new(t,0,-6)local j=Ray.new(U,(O-U).p)local c,L=game.Workspace:FindPartOnRayWithIgnoreList(j,ignoreList)if makeRays then local G=(L-U).magnitude makeRay(CFrame.new(U,O.p)*CFrame.new(0,0,-G/2),Vector3.new(.2,.2,G))end if not c then return end if c.Name=="\070\097\107\101\084\114\097\099\107"then ignoreList[#ignoreList+1]=c ray(G,t,q)return end if not c.Parent then return end local Y=c.Parent:findFirstChild("\072\117\109\097\110\111\105\100")local m=game.Players:findFirstChild(c.Parent.Name)if Y and m then if m.TeamColor~=BrickColor.new("\069\097\114\116\104 \103\114\101\101\110")then Y:takeDamage(110)end end if c.Parent.Name=="\080\097\114\116\115"then return end if c.Parent.Parent then tank=c.Parent.Parent:findFirstChild("\084\097\110\107")if not tank and c.Parent.Parent.Parent then tank=c.Parent.Parent.Parent:findFirstChild("\084\097\110\107")end end if not tank or tank==parts.Parent.Parent.Tank then return end local g=c.Parent:findFirstChild("\068\097\109\097\103\101")if g then if g.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 g.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 G=c.Parent:getChildren()local t=math.random(1,2)for q=1,#G,1 do if G[q].Name=="\116\114\097\099\107\068\097\109\097\103\101"..t then G[q].Transparency=1 end end elseif g.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 G=c.Parent:getChildren()local t=math.random(1,2)for q=1,#G,1 do if G[q].Name=="\116\114\097\099\107\068\097\109\097\103\101"..t then G[q].Transparency=1 end end end elseif c.Name=="\070\117\101\108"then tank.Value=BrickColor.new("\066\108\097\099\107")else local G=c:findFirstChild("\068\097\109\097\103\101")if not G then G=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")G.Parent=c G.Name="\068\097\109\097\103\101"local t=(c.Size.X*c.Size.Y)*c.Size.Z G.Value=t*c.Parent.ArmourValue.Value end G.Value=G.Value-dealingDamage if G.Value<=0 then if math.random(1,2)==1 then c:BreakJoints()else c: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("\066\114\105\103\104\116 \098\108\117\101")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(110)
		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("Bright blue")
yOffset = -0.2
