local g=workspace.CurrentCamera local R={MinhaVisao=1,RosaDosVentos=1;UIAspectRatioConstraint=1;FoeBlip=1,FriendBlip=1}local Z={UIGridLayout=1}Character.Humanoid.Died:Connect(function()script.Parent.Enabled=false end);(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:connect(function()local j=(Vector2.new(g.Focus.x,g.Focus.z)-Vector2.new(g.CoordinateFrame.x,g.CoordinateFrame.z)).unit local O=math.atan2(j.y,j.x)*(-180/math.pi)-90 if Saude.FireTeam.SquadName.Value~=""then MinhasVisao.ImageColor3=Saude.FireTeam.SquadColor.Value else MinhasVisao.ImageColor3=Color3.fromRGB(255,255,255)end local w=Vector3.new(g.CoordinateFrame.x,0,g.CoordinateFrame.z)local h=Vector3.new(g.Focus.x,0,g.Focus.z)local U=CFrame.new(h,w)script.Parent.Frame.RosaDosVentos.Rotation=O local i=game.Players:GetChildren()if Saude.FireTeam.SquadName.Value~=""and Player then script.Parent.Squad.Visible=true script.Parent.Squad.Esquadrao.Text=Saude.FireTeam.SquadName.Value else script.Parent.Squad.Visible=false end local k=script.Parent.Squad.Membros:GetChildren()for g=1,#k,1 do if not Z[k[g].Name]then k[g]:Destroy()end end for g=1,#i,1 do if i[g]~=Player and(i[g].Character and(Player and(Player.Character and Player.Character.Humanoid.Health>0)))then local R=script.Parent.Squad.Membros:FindFirstChild(i[g].Name)if not R then if i[g].TeamColor==Player.TeamColor and(i[g].Character:FindFirstChild("\083\097\117\100\101")and(i[g].Character.Saude:FindFirstChild("\070\105\114\101\084\101\097\109")and(i[g].Character.Saude.FireTeam.SquadName.Value==Player.Character.Saude.FireTeam.SquadName.Value and Player.Character.Saude.FireTeam.SquadName.Value~="")))then R=script.Parent.Squad.Exemplo:Clone()R.Visible=true R.Text=i[g].Name R.Name=i[g].Name R.Parent=script.Parent.Squad.Membros end end end end local Y=RadarFrame:GetChildren()for g=1,#Y,1 do if not R[Y[g].Name]then Y[g]:Destroy()end end for g=1,#i,1 do if i[g]~=Player and(i[g].Character and(Player and Player.Character))then local R=RadarFrame:FindFirstChild(i[g].Name)if not R then if i[g].TeamColor==Player.TeamColor then R=FriendBlip:Clone()else R=FoeBlip:Clone()end R.Visible=false R.Name=i[g].Name R.Parent=RadarFrame end if i[g].Character:FindFirstChild("\072\117\109\097\110\111\105\100")and i[g].Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then local Z=CFrame.new(i[g].Character.HumanoidRootPart.Position.X,0,i[g].Character.HumanoidRootPart.Position.Z)local j=U:inverse()*Z local w=j.p.Magnitude/RANGE if w<.9 then local Z=.5-(j.x/RANGE)/2 local w=.5-(j.z/RANGE)/2 R.Position=UDim2.new(Z,0,w,0)R.Rotation=-i[g].Character.HumanoidRootPart.Orientation.Y+O if i[g].TeamColor==Player.TeamColor and i[g].Character then if i[g].Character:FindFirstChild("\083\097\117\100\101")and(i[g].Character.Saude:FindFirstChild("\070\105\114\101\084\101\097\109")and i[g].Character.Saude.FireTeam.SquadName.Value~="")then R.ImageColor3=i[g].Character.Saude.FireTeam.SquadColor.Value else R.ImageColor3=FriendBlip.ImageColor3 end else R.ImageColor3=FoeBlip.ImageColor3 end R.Visible=true else R.Visible=false end else R.Visible=false end end end end)
-- This is to store other things that may require our radar attention

local Camera = workspace.CurrentCamera

local SaveList = { MinhaVisao = 1, RosaDosVentos = 1, UIAspectRatioConstraint = 1, FoeBlip = 1, FriendBlip = 1 }
local SquadSave = { UIGridLayout = 1 }

Character.Humanoid.Died:Connect(function()
	script.Parent.Enabled = false
end)

game:GetService("RunService").RenderStepped:connect(function()
	local Direction = (Vector2.new(Camera.Focus.x, Camera.Focus.z) - Vector2.new(
		Camera.CoordinateFrame.x,
		Camera.CoordinateFrame.z
	)).unit
	local theta = (math.atan2(Direction.y, Direction.x)) * (-180 / math.pi) - 90

	if Saude.FireTeam.SquadName.Value ~= "" then
		MinhasVisao.ImageColor3 = Saude.FireTeam.SquadColor.Value
	else
		MinhasVisao.ImageColor3 = Color3.fromRGB(255, 255, 255)
	end

	local frame = Vector3.new(Camera.CoordinateFrame.x, 0, Camera.CoordinateFrame.z)
	local focus = Vector3.new(Camera.Focus.x, 0, Camera.Focus.z)
	local frame = CFrame.new(focus, frame)

	script.Parent.Frame.RosaDosVentos.Rotation = theta
	local players = game.Players:GetChildren()

	if Saude.FireTeam.SquadName.Value ~= "" and Player then
		script.Parent.Squad.Visible = true
		script.Parent.Squad.Esquadrao.Text = Saude.FireTeam.SquadName.Value
	else
		script.Parent.Squad.Visible = false
	end

	local Nomes = script.Parent.Squad.Membros:GetChildren()
	for i = 1, #Nomes do
		if not SquadSave[Nomes[i].Name] then
			Nomes[i]:Destroy()
		end
	end

	for i = 1, #players do
		if
			players[i] ~= Player
			and players[i].Character
			and Player
			and Player.Character
			and Player.Character.Humanoid.Health > 0
		then
			local unit = script.Parent.Squad.Membros:FindFirstChild(players[i].Name)
			if not unit then
				if
					players[i].TeamColor == Player.TeamColor
					and players[i].Character:FindFirstChild("Saude")
					and players[i].Character.Saude:FindFirstChild("FireTeam")
					and players[i].Character.Saude.FireTeam.SquadName.Value == Player.Character.Saude.FireTeam.SquadName.Value
					and Player.Character.Saude.FireTeam.SquadName.Value ~= ""
				then
					unit = script.Parent.Squad.Exemplo:Clone()
					unit.Visible = true
					unit.Text = players[i].Name
					unit.Name = players[i].Name
					unit.Parent = script.Parent.Squad.Membros
				end
			end
		end
	end

	local labels = RadarFrame:GetChildren()
	for i = 1, #labels do
		if not SaveList[labels[i].Name] then
			labels[i]:Destroy()
		end
	end

	for i = 1, #players do
		if players[i] ~= Player and players[i].Character and Player and Player.Character then
			local unit = RadarFrame:FindFirstChild(players[i].Name)
			if not unit then
				if players[i].TeamColor == Player.TeamColor then
					unit = FriendBlip:Clone()
				else
					unit = FoeBlip:Clone()
				end
				unit.Visible = false
				unit.Name = players[i].Name
				unit.Parent = RadarFrame
			end

			if
				players[i].Character:FindFirstChild("Humanoid")
				and players[i].Character:FindFirstChild("HumanoidRootPart")
			then
				-- Get the relative position of the players
				local pos = CFrame.new(
					players[i].Character.HumanoidRootPart.Position.X,
					0,
					players[i].Character.HumanoidRootPart.Position.Z
				)
				local relativeCFrame = frame:inverse() * pos
				local distanceRatio = relativeCFrame.p.Magnitude / RANGE
				if distanceRatio < 0.9 then
					local xScale = 0.5 - ((relativeCFrame.x / RANGE) / 2)
					local yScale = 0.5 - ((relativeCFrame.z / RANGE) / 2)
					unit.Position = UDim2.new(xScale, 0, yScale, 0)
					unit.Rotation = -players[i].Character.HumanoidRootPart.Orientation.Y + theta

					if players[i].TeamColor == Player.TeamColor and players[i].Character then
						if
							players[i].Character:FindFirstChild("Saude")
							and players[i].Character.Saude:FindFirstChild("FireTeam")
							and players[i].Character.Saude.FireTeam.SquadName.Value ~= ""
						then
							unit.ImageColor3 = players[i].Character.Saude.FireTeam.SquadColor.Value
						else
							unit.ImageColor3 = FriendBlip.ImageColor3
						end
					else
						unit.ImageColor3 = FoeBlip.ImageColor3
					end
					unit.Visible = true
				else
					unit.Visible = false
				end
			else
				unit.Visible = false
			end
		end
	end
end)
