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


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)
