local u=workspace.CurrentCamera local q={MinhaVisao=1;RosaDosVentos=1,FoeBlip=1;FriendBlip=1}local h={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 S=(Vector2.new(u.Focus.x,u.Focus.z)-Vector2.new(u.CoordinateFrame.x,u.CoordinateFrame.z)).unit local Y=math.atan2(S.y,S.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 p=Vector3.new(u.CoordinateFrame.x,0,u.CoordinateFrame.z)local t=Vector3.new(u.Focus.x,0,u.Focus.z)local e=CFrame.new(t,p)script.Parent.Frame.RosaDosVentos.Rotation=Y local j=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 J=script.Parent.Squad.Membros:GetChildren()for u=1,#J,1 do if not h[J[u].Name]then J[u]:Destroy()end end for u=1,#j,1 do if j[u]~=Player and(j[u].Character and(Player and Player.Character))then local q=script.Parent.Squad.Membros:FindFirstChild(j[u].Name)if not q then if j[u].TeamColor==Player.TeamColor and(j[u].Character.Saude.FireTeam.SquadName.Value==Player.Character.Saude.FireTeam.SquadName.Value and Player.Character.Saude.FireTeam.SquadName.Value~="")then q=script.Parent.Squad.Exemplo:Clone()q.Visible=true q.Text=j[u].Name q.Name=j[u].Name q.Parent=script.Parent.Squad.Membros end end end end local w=RadarFrame:GetChildren()for u=1,#w,1 do if not q[w[u].Name]then w[u]:Destroy()end end for u=1,#j,1 do if j[u]~=Player and(j[u].Character and(Player and Player.Character))then local q=RadarFrame:FindFirstChild(j[u].Name)if not q then if j[u].TeamColor==Player.TeamColor then q=FriendBlip:Clone()else q=FoeBlip:Clone()end q.Visible=false q.Name=j[u].Name q.Parent=RadarFrame end if j[u].Character:FindFirstChild("\072\117\109\097\110\111\105\100")and j[u].Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then local h=CFrame.new(j[u].Character.HumanoidRootPart.Position.X,0,j[u].Character.HumanoidRootPart.Position.Z)local S=e:inverse()*h local p=S.p.Magnitude/RANGE if p<.9 then local h=.5-(S.x/RANGE)/2 local p=.5-(S.z/RANGE)/2 q.Position=UDim2.new(h,0,p,0)q.Rotation=-j[u].Character.HumanoidRootPart.Orientation.Y+Y if j[u].TeamColor==Player.TeamColor then if j[u].Character.Saude.FireTeam.SquadName.Value~=""then q.ImageColor3=j[u].Character.Saude.FireTeam.SquadColor.Value else q.ImageColor3=FriendBlip.ImageColor3 end else q.ImageColor3=FoeBlip.ImageColor3 end q.Visible=true else q.Visible=false end else q.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, 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 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.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 then
						if 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)
