radar lock on script
Key RequiredUniversal

radar lock on script

Universal ScriptRAT_RAT_ 110 views 77 executesUpdated Jul 10, 2026
Unrated
00
Lua Script•828 lines (23857 chars)
--[[
    (press M to toggle)
    - Press X or click the same blip again to unlock
]]

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")


local PHOSPHOR = Color3.fromRGB(72, 255, 88)
local PHOSPHOR_BRIGHT = Color3.fromRGB(120, 255, 130)
local PHOSPHOR_DIM = Color3.fromRGB(35, 140, 50)
local PHOSPHOR_FAINT = Color3.fromRGB(18, 70, 25)
local BG_DARK = Color3.fromRGB(2, 8, 3)
local BG_BEZEL = Color3.fromRGB(8, 22, 10)

-- // CONFIG
local WT_RADAR_CONFIG = {
	Size = 190,
	BezelPadding = 6,
	Position = UDim2.new(2, -100, 1, -100),
	AnchorPoint = Vector2.new(1, 1),
	Range = 1000,

	ShowGrid = true,
	ShowSweep = true,
	ShowSweepTrail = true, -- fading trail behind sweep (WT style)
	ShowRangeRings = true,
	ShowCompassTicks = true,
	ShowScanlines = true, -- CRT scanline overlay
	ShowAltitude = true,
	ShowPlayerNames = true,
	RotateWithHeading = true,

	-- Targeting
	TrackCamera = true, -- 
	TrackStrength = 5, -- 
	MaxTrackRange = 1200, -- 
	UnlockKey = Enum.KeyCode.X,
	AutoScriptableCamera = true, -- 

	BlipSize = 5,
	AltitudeThreshold = 25,
	ToggleKey = Enum.KeyCode.M,
	JetModelNames = {},
}

-- // UI root
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "WTRadarGui"
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
screenGui.Parent = playerGui


local bezelFrame = Instance.new("Frame")
bezelFrame.Name = "Bezel"
bezelFrame.Size = UDim2.fromOffset(WT_RADAR_CONFIG.Size + WT_RADAR_CONFIG.BezelPadding * 2, WT_RADAR_CONFIG.Size + WT_RADAR_CONFIG.BezelPadding * 2 + 28)
bezelFrame.Position = WT_RADAR_CONFIG.Position
bezelFrame.AnchorPoint = WT_RADAR_CONFIG.AnchorPoint
bezelFrame.BackgroundColor3 = BG_BEZEL
bezelFrame.BackgroundTransparency = 0.15
bezelFrame.BorderSizePixel = 0
bezelFrame.Parent = screenGui

local bezelStroke = Instance.new("UIStroke")
bezelStroke.Color = PHOSPHOR_DIM
bezelStroke.Thickness = 1
bezelStroke.Transparency = 0.3
bezelStroke.Parent = bezelFrame


for i, data in ipairs({
	{ pos = UDim2.fromOffset(4, 4), size = UDim2.fromOffset(12, 2), size2 = UDim2.fromOffset(2, 12) },
	{ pos = UDim2.new(1, -16, 0, 4), size = UDim2.fromOffset(12, 2), size2 = UDim2.fromOffset(2, 12) },
	{ pos = UDim2.fromOffset(4, 1, -16), size = UDim2.fromOffset(12, 2), size2 = UDim2.fromOffset(2, 12) },
	{ pos = UDim2.new(1, -16, 1, -32), size = UDim2.fromOffset(12, 2), size2 = UDim2.fromOffset(2, 12) },
}) do
	local h = Instance.new("Frame")
	h.Size = data.size
	h.Position = data.pos
	h.BackgroundColor3 = PHOSPHOR
	h.BackgroundTransparency = 0.4
	h.BorderSizePixel = 0
	h.Parent = bezelFrame

	local v = Instance.new("Frame")
	v.Size = data.size2
	v.Position = data.pos
	v.BackgroundColor3 = PHOSPHOR
	v.BackgroundTransparency = 0.4
	v.BorderSizePixel = 0
	v.Parent = bezelFrame
end

local radarFrame = Instance.new("Frame")
radarFrame.Name = "Radar"
radarFrame.Size = UDim2.fromOffset(WT_RADAR_CONFIG.Size, WT_RADAR_CONFIG.Size)
radarFrame.Position = UDim2.fromOffset(WT_RADAR_CONFIG.BezelPadding, WT_RADAR_CONFIG.BezelPadding)
radarFrame.BackgroundColor3 = BG_DARK
radarFrame.BackgroundTransparency = 0.05
radarFrame.BorderSizePixel = 0
radarFrame.Parent = bezelFrame

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = radarFrame

local stroke = Instance.new("UIStroke")
stroke.Color = PHOSPHOR_DIM
stroke.Thickness = 1.5
stroke.Transparency = 0.2
stroke.Parent = radarFrame

local displayFrame = Instance.new("Frame")
displayFrame.Name = "Display"
displayFrame.Size = UDim2.fromScale(1, 1)
displayFrame.BackgroundTransparency = 1
displayFrame.ClipsDescendants = true
displayFrame.Parent = radarFrame

local displayCorner = Instance.new("UICorner")
displayCorner.CornerRadius = UDim.new(1, 0)
displayCorner.Parent = displayFrame


local vignette = Instance.new("Frame")
vignette.Name = "Vignette"
vignette.Size = UDim2.fromScale(1, 1)
vignette.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
vignette.BackgroundTransparency = 0.55
vignette.BorderSizePixel = 0
vignette.ZIndex = 8
vignette.Parent = displayFrame

local vignetteCorner = Instance.new("UICorner")
vignetteCorner.CornerRadius = UDim.new(1, 0)
vignetteCorner.Parent = vignette

local vignetteGradient = Instance.new("UIGradient")
vignetteGradient.Transparency = NumberSequence.new({
	NumberSequenceKeypoint.new(0, 0.3),
	NumberSequenceKeypoint.new(0.5, 1),
	NumberSequenceKeypoint.new(1, 0.3),
})
vignetteGradient.Parent = vignette


if WT_RADAR_CONFIG.ShowRangeRings then
	for i = 1, 3 do
		local ring = Instance.new("Frame")
		ring.Name = "Ring" .. i
		ring.AnchorPoint = Vector2.new(0.5, 0.5)
		ring.Position = UDim2.fromScale(0.5, 0.5)
		ring.Size = UDim2.fromScale(i * 0.25 + 0.25, i * 0.25 + 0.25)
		ring.BackgroundTransparency = 1
		ring.BorderSizePixel = 0
		ring.ZIndex = 1
		ring.Parent = displayFrame

		local ringStroke = Instance.new("UIStroke")
		ringStroke.Color = PHOSPHOR_FAINT
		ringStroke.Thickness = 1
		ringStroke.Transparency = i == 3 and 0.5 or 0.35
		ringStroke.Parent = ring

		local ringCorner = Instance.new("UICorner")
		ringCorner.CornerRadius = UDim.new(1, 0)
		ringCorner.Parent = ring
	end
end


if WT_RADAR_CONFIG.ShowCompassTicks then
	local tickCount = 36
	for i = 0, tickCount - 1 do
		local angle = math.rad(i * (360 / tickCount))
		local isMajor = i % 9 == 0
		local tickLen = isMajor and 8 or 4
		local tickWidth = isMajor and 2 or 1
		local radius = WT_RADAR_CONFIG.Size / 2 - 2

		local tick = Instance.new("Frame")
		tick.Name = "Tick" .. i
		tick.AnchorPoint = Vector2.new(0.5, 1)
		tick.Size = UDim2.fromOffset(tickWidth, tickLen)
		tick.Position = UDim2.fromOffset(
			WT_RADAR_CONFIG.Size / 2 + math.sin(angle) * radius,
			WT_RADAR_CONFIG.Size / 2 - math.cos(angle) * radius
		)
		tick.Rotation = i * (360 / tickCount)
		tick.BackgroundColor3 = isMajor and PHOSPHOR_DIM or PHOSPHOR_FAINT
		tick.BackgroundTransparency = isMajor and 0.2 or 0.5
		tick.BorderSizePixel = 0
		tick.ZIndex = 2
		tick.Parent = displayFrame
	end
end


if WT_RADAR_CONFIG.ShowGrid then
	for _, axis in ipairs({ "Horizontal", "Vertical" }) do
		local line = Instance.new("Frame")
		line.Name = axis .. "Line"
		line.BackgroundColor3 = PHOSPHOR_FAINT
		line.BackgroundTransparency = 0.35
		line.BorderSizePixel = 0
		line.ZIndex = 2
		line.Parent = displayFrame

		if axis == "Horizontal" then
			line.Size = UDim2.new(1, 0, 0, 1)
			line.Position = UDim2.fromScale(0, 0.5)
		else
			line.Size = UDim2.new(0, 1, 1, 0)
			line.Position = UDim2.fromScale(0.5, 0)
		end
	end
end


local sweepLines = {}
local spinContainer = Instance.new("Frame")
spinContainer.Name = "SpinContainer"
spinContainer.AnchorPoint = Vector2.new(0.5, 0.5)
spinContainer.Position = UDim2.fromScale(0.5, 0.5)
spinContainer.Size = UDim2.fromScale(1, 1)
spinContainer.BackgroundTransparency = 1
spinContainer.ZIndex = 9
spinContainer.Parent = displayFrame

if WT_RADAR_CONFIG.ShowSweep then
	local trailCount = WT_RADAR_CONFIG.ShowSweepTrail and 3 or 0

	for i = 0, trailCount do
		local line = Instance.new("Frame")
		line.Name = i == 0 and "SpinLine" or "SpinTrail" .. i
		-- anchor at bottom so line only goes out one side from center
		line.AnchorPoint = Vector2.new(0.5, 1)
		line.Position = UDim2.fromScale(0.5, 0.5)
		line.Size = UDim2.new(0, i == 0 and 3 or 2, 0.5, -4)
		line.BackgroundColor3 = i == 0 and PHOSPHOR_BRIGHT or PHOSPHOR
		line.BackgroundTransparency = i == 0 and 0 or 0.15 + i * 0.2
		line.BorderSizePixel = 0
		line.Parent = spinContainer
		sweepLines[i] = line
	end

	
	local centerDot = Instance.new("Frame")
	centerDot.Name = "SpinPivot"
	centerDot.AnchorPoint = Vector2.new(0.5, 0.5)
	centerDot.Position = UDim2.fromScale(0.5, 0.5)
	centerDot.Size = UDim2.fromOffset(4, 4)
	centerDot.BackgroundColor3 = PHOSPHOR_BRIGHT
	centerDot.BackgroundTransparency = 0
	centerDot.BorderSizePixel = 0
	centerDot.Parent = spinContainer

	local dotCorner = Instance.new("UICorner")
	dotCorner.CornerRadius = UDim.new(1, 0)
	dotCorner.Parent = centerDot
end


if WT_RADAR_CONFIG.ShowScanlines then
	local scanContainer = Instance.new("Frame")
	scanContainer.Name = "Scanlines"
	scanContainer.Size = UDim2.fromScale(1, 1)
	scanContainer.BackgroundTransparency = 1
	scanContainer.ZIndex = 7
	scanContainer.ClipsDescendants = true
	scanContainer.Parent = displayFrame

	local scanCorner = Instance.new("UICorner")
	scanCorner.CornerRadius = UDim.new(1, 0)
	scanCorner.Parent = scanContainer

	for y = 0, WT_RADAR_CONFIG.Size, 3 do
		local scan = Instance.new("Frame")
		scan.Size = UDim2.new(1, 0, 0, 1)
		scan.Position = UDim2.fromOffset(0, y)
		scan.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
		scan.BackgroundTransparency = 0.88
		scan.BorderSizePixel = 0
		scan.Parent = scanContainer
	end
end

local blipContainer = Instance.new("Frame")
blipContainer.Name = "Blips"
blipContainer.Size = UDim2.fromScale(1, 1)
blipContainer.BackgroundTransparency = 1
blipContainer.ZIndex = 10
blipContainer.Parent = displayFrame


local function makeCenterLine(horizontal)
	local line = Instance.new("Frame")
	line.AnchorPoint = Vector2.new(0.5, 0.5)
	line.Position = UDim2.fromScale(0.5, 0.5)
	line.BackgroundColor3 = PHOSPHOR_BRIGHT
	line.BackgroundTransparency = 0.15
	line.BorderSizePixel = 0
	line.ZIndex = 6
	line.Parent = blipContainer

	if horizontal then
		line.Size = UDim2.fromOffset(10, 1)
	else
		line.Size = UDim2.fromOffset(1, 10)
	end
end

makeCenterLine(true)
makeCenterLine(false)


local headingTick = Instance.new("Frame")
headingTick.Name = "HeadingTick"
headingTick.AnchorPoint = Vector2.new(0.5, 1)
headingTick.Position = UDim2.fromScale(0.5, 0.5)
headingTick.Size = UDim2.fromOffset(2, 10)
headingTick.BackgroundColor3 = PHOSPHOR_BRIGHT
headingTick.BackgroundTransparency = 0.1
headingTick.BorderSizePixel = 0
headingTick.ZIndex = 6
headingTick.Parent = blipContainer


local function styleLabel(label)
	label.BackgroundTransparency = 1
	label.Font = Enum.Font.Code
	label.TextColor3 = PHOSPHOR
	label.TextStrokeColor3 = PHOSPHOR_DIM
	label.TextStrokeTransparency = 0.5
end

local titleLabel = Instance.new("TextLabel")
titleLabel.Name = "Title"
titleLabel.Size = UDim2.new(1, 0, 0, 14)
titleLabel.Position = UDim2.fromOffset(0, WT_RADAR_CONFIG.Size + WT_RADAR_CONFIG.BezelPadding + 2)
titleLabel.Text = "RDR"
titleLabel.TextSize = 11
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
styleLabel(titleLabel)
titleLabel.Parent = bezelFrame

local rangeLabel = Instance.new("TextLabel")
rangeLabel.Name = "RangeLabel"
rangeLabel.Size = UDim2.new(0.5, 0, 0, 14)
rangeLabel.Position = UDim2.fromOffset(0, WT_RADAR_CONFIG.Size + WT_RADAR_CONFIG.BezelPadding + 14)
rangeLabel.Text = "RNG " .. WT_RADAR_CONFIG.Range
rangeLabel.TextSize = 10
rangeLabel.TextXAlignment = Enum.TextXAlignment.Left
styleLabel(rangeLabel)
rangeLabel.Parent = bezelFrame

local headingLabel = Instance.new("TextLabel")
headingLabel.Name = "HeadingLabel"
headingLabel.Size = UDim2.new(0.5, 0, 0, 14)
headingLabel.Position = UDim2.new(0.5, 0, WT_RADAR_CONFIG.Size + WT_RADAR_CONFIG.BezelPadding + 14, 0)
headingLabel.Text = "000"
headingLabel.TextSize = 10
headingLabel.TextXAlignment = Enum.TextXAlignment.Right
styleLabel(headingLabel)
headingLabel.Parent = bezelFrame

local targetLabel = Instance.new("TextLabel")
targetLabel.Name = "TargetLabel"
targetLabel.Size = UDim2.new(1, 0, 0, 14)
targetLabel.Position = UDim2.fromOffset(0, -18)
targetLabel.Text = "TGT ---"
targetLabel.TextSize = 10
targetLabel.TextXAlignment = Enum.TextXAlignment.Left
styleLabel(targetLabel)
targetLabel.Parent = bezelFrame


local lockReticle = Instance.new("Frame")
lockReticle.Name = "LockReticle"
lockReticle.Size = UDim2.fromOffset(48, 48)
lockReticle.AnchorPoint = Vector2.new(0.5, 0.5)
lockReticle.BackgroundTransparency = 1
lockReticle.Visible = false
lockReticle.Parent = screenGui

local function makeReticleCorner(xScale, yScale, rot)
	local cornerMark = Instance.new("Frame")
	cornerMark.Size = UDim2.fromOffset(10, 2)
	cornerMark.Position = UDim2.new(xScale, xScale < 0.5 and 0 or -10, yScale, yScale < 0.5 and 0 or -2)
	cornerMark.BackgroundColor3 = PHOSPHOR_BRIGHT
	cornerMark.BackgroundTransparency = 0
	cornerMark.BorderSizePixel = 0
	cornerMark.Rotation = rot
	cornerMark.Parent = lockReticle

	local cornerMark2 = Instance.new("Frame")
	cornerMark2.Size = UDim2.fromOffset(2, 10)
	cornerMark2.Position = UDim2.new(xScale, xScale < 0.5 and 0 or -2, yScale, yScale < 0.5 and 0 or -10)
	cornerMark2.BackgroundColor3 = PHOSPHOR_BRIGHT
	cornerMark2.BackgroundTransparency = 0
	cornerMark2.BorderSizePixel = 0
	cornerMark2.Rotation = rot
	cornerMark2.Parent = lockReticle
end

makeReticleCorner(0, 0, 0)
makeReticleCorner(1, 0, 90)
makeReticleCorner(0, 1, 270)
makeReticleCorner(1, 1, 180)

local lockNameTag = Instance.new("TextLabel")
lockNameTag.Name = "LockName"
lockNameTag.Size = UDim2.new(0, 120, 0, 14)
lockNameTag.Position = UDim2.new(0.5, 0, 1, 4)
lockNameTag.AnchorPoint = Vector2.new(0.5, 0)
lockNameTag.BackgroundTransparency = 1
lockNameTag.Font = Enum.Font.Code
lockNameTag.TextSize = 11
lockNameTag.TextColor3 = PHOSPHOR_BRIGHT
lockNameTag.TextStrokeColor3 = PHOSPHOR_DIM
lockNameTag.TextStrokeTransparency = 0.3
lockNameTag.Text = ""
lockNameTag.Parent = lockReticle


local blipPool = {}
local sweepAngle = 0
local lockedTarget = nil
local savedCameraType = nil
local savedCameraSubject = nil

local function getBlipColor(player)
	
	if player.Team and localPlayer.Team then
		if player.Team == localPlayer.Team then
			return PHOSPHOR_DIM
		end
		return PHOSPHOR_BRIGHT
	end
	return PHOSPHOR
end

local function isJetModel(model)
	if #WT_RADAR_CONFIG.JetModelNames == 0 then
		return true
	end
	for _, name in WT_RADAR_CONFIG.JetModelNames do
		if model.Name == name then
			return true
		end
	end
	return false
end

local function getPlayerAircraftData(player)
	local character = player.Character
	if not character then
		return nil
	end

	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid and humanoid.SeatPart then
		local seat = humanoid.SeatPart
		local vehicle = seat:FindFirstAncestorOfClass("Model")
		if vehicle and vehicle.PrimaryPart then
			return {
				position = vehicle.PrimaryPart.Position,
				lookVector = vehicle.PrimaryPart.CFrame.LookVector,
				altitude = vehicle.PrimaryPart.Position.Y,
				inJet = isJetModel(vehicle),
			}
		end
		if seat:IsA("BasePart") then
			return {
				position = seat.Position,
				lookVector = seat.CFrame.LookVector,
				altitude = seat.Position.Y,
				inJet = true,
			}
		end
	end

	local root = character:FindFirstChild("HumanoidRootPart")
		or character:FindFirstChild("Torso")
		or character:FindFirstChild("UpperTorso")

	if root then
		return {
			position = root.Position,
			lookVector = root.CFrame.LookVector,
			altitude = root.Position.Y,
			inJet = false,
		}
	end

	return nil
end

local function getHeadingYaw(lookVector)
	return math.atan2(lookVector.X, lookVector.Z)
end

local function getCameraYaw()
	local camera = workspace.CurrentCamera
	if not camera then
		return 0
	end
	local _, yaw = camera.CFrame:ToEulerAnglesYXZ()
	return yaw
end

local function worldToRadarOffset(worldPos, localPos, headingYaw)
	local relative = Vector3.new(worldPos.X - localPos.X, 0, worldPos.Z - localPos.Z)

	if WT_RADAR_CONFIG.RotateWithHeading then
		local cos = math.cos(headingYaw)
		local sin = math.sin(headingYaw)
		local rotatedX = relative.X * cos - relative.Z * sin
		local rotatedZ = relative.X * sin + relative.Z * cos
		relative = Vector3.new(rotatedX, 0, rotatedZ)
	end

	local halfSize = WT_RADAR_CONFIG.Size / 2
	local scale = halfSize / WT_RADAR_CONFIG.Range

	return Vector2.new(relative.X * scale, relative.Z * scale)
end

local function isEnemy(player)
	if player.Team and localPlayer.Team then
		return player.Team ~= localPlayer.Team
	end
	return player ~= localPlayer
end

local function setLockedTarget(player)
	if lockedTarget == player then
		player = nil
	end

	if lockedTarget and not player and WT_RADAR_CONFIG.AutoScriptableCamera then
		local camera = workspace.CurrentCamera
		if camera and savedCameraType then
			camera.CameraType = savedCameraType
			camera.CameraSubject = savedCameraSubject
		end
		savedCameraType = nil
		savedCameraSubject = nil
	end

	lockedTarget = player

	if player then
		targetLabel.Text = "TGT " .. string.upper(player.DisplayName)
		lockNameTag.Text = player.DisplayName

		if WT_RADAR_CONFIG.AutoScriptableCamera then
			local camera = workspace.CurrentCamera
			if camera and not savedCameraType then
				savedCameraType = camera.CameraType
				savedCameraSubject = camera.CameraSubject
				camera.CameraType = Enum.CameraType.Scriptable
			end
		end
	else
		targetLabel.Text = "TGT ---"
		lockReticle.Visible = false
	end
end

local function createBlip(player)
	-- Clickable blip button (larger hit area for names + dot)
	local blipButton = Instance.new("TextButton")
	blipButton.Name = player.Name .. "BlipButton"
	blipButton.Size = UDim2.fromOffset(56, 28)
	blipButton.AnchorPoint = Vector2.new(0.5, 0.5)
	blipButton.BackgroundTransparency = 1
	blipButton.BorderSizePixel = 0
	blipButton.Text = ""
	blipButton.AutoButtonColor = false
	blipButton.ZIndex = 10
	blipButton.Parent = blipContainer

	local blip = Instance.new("Frame")
	blip.Name = "Dot"
	blip.Size = UDim2.fromOffset(WT_RADAR_CONFIG.BlipSize, WT_RADAR_CONFIG.BlipSize)
	blip.AnchorPoint = Vector2.new(0.5, 0.5)
	blip.Position = UDim2.fromScale(0.5, 0.65)
	blip.BackgroundColor3 = getBlipColor(player)
	blip.BackgroundTransparency = 0.1
	blip.BorderSizePixel = 0
	blip.ZIndex = 11
	blip.Parent = blipButton

	local blipStroke = Instance.new("UIStroke")
	blipStroke.Name = "Stroke"
	blipStroke.Color = PHOSPHOR_BRIGHT
	blipStroke.Thickness = 1
	blipStroke.Transparency = 0.4
	blipStroke.Parent = blip

	local nameLabel = Instance.new("TextLabel")
	nameLabel.Name = "Name"
	nameLabel.Size = UDim2.new(1, 0, 0, 12)
	nameLabel.Position = UDim2.new(0.5, 0, 0, 0)
	nameLabel.AnchorPoint = Vector2.new(0.5, 0)
	nameLabel.BackgroundTransparency = 1
	nameLabel.Font = Enum.Font.Code
	nameLabel.TextSize = 8
	nameLabel.TextColor3 = PHOSPHOR
	nameLabel.TextStrokeColor3 = PHOSPHOR_DIM
	nameLabel.TextStrokeTransparency = 0.35
	nameLabel.Text = player.DisplayName
	nameLabel.ZIndex = 11
	nameLabel.Parent = blipButton

	local entry = { button = blipButton, frame = blip, stroke = blipStroke, nameLabel = nameLabel }

	if WT_RADAR_CONFIG.ShowAltitude then
		local altLabel = Instance.new("TextLabel")
		altLabel.Name = "Alt"
		altLabel.Size = UDim2.fromOffset(10, 10)
		altLabel.Position = UDim2.new(0.5, 10, 0.65, -5)
		altLabel.AnchorPoint = Vector2.new(0.5, 0.5)
		altLabel.BackgroundTransparency = 1
		altLabel.Font = Enum.Font.Code
		altLabel.TextSize = 8
		altLabel.TextColor3 = PHOSPHOR
		altLabel.TextStrokeColor3 = PHOSPHOR_DIM
		altLabel.TextStrokeTransparency = 0.3
		altLabel.Text = ""
		altLabel.Visible = false
		altLabel.ZIndex = 11
		altLabel.Parent = blipButton
		entry.altLabel = altLabel
	end

	blipButton.MouseButton1Click:Connect(function()
		if isEnemy(player) then
			setLockedTarget(player)
		end
	end)

	blipPool[player] = entry
end

local function removeBlip(player)
	local entry = blipPool[player]
	if entry then
		entry.button:Destroy()
		blipPool[player] = nil
	end
	if lockedTarget == player then
		setLockedTarget(nil)
	end
end

local function updateRadar()
	local localData = getPlayerAircraftData(localPlayer)
	if not localData then
		return
	end

	local headingYaw = WT_RADAR_CONFIG.RotateWithHeading and getHeadingYaw(localData.lookVector) or getCameraYaw()
	local headingDegrees = math.floor((math.deg(headingYaw) % 360 + 360) % 360)
	headingLabel.Text = string.format("%03d°", headingDegrees)

	local localPos = localData.position

	for player, entry in pairs(blipPool) do
		local targetData = getPlayerAircraftData(player)

		if not targetData then
			entry.button.Visible = false
			continue
		end

		local flatDistance = (Vector3.new(targetData.position.X, 0, targetData.position.Z)
			- Vector3.new(localPos.X, 0, localPos.Z)).Magnitude

		if flatDistance > WT_RADAR_CONFIG.Range then
			entry.button.Visible = false
			continue
		end

		local offset = worldToRadarOffset(targetData.position, localPos, headingYaw)
		local maxRadius = WT_RADAR_CONFIG.Size / 2 - WT_RADAR_CONFIG.BlipSize

		if offset.Magnitude > maxRadius then
			offset = offset.Unit * maxRadius
		end

		entry.button.Position = UDim2.fromOffset(
			WT_RADAR_CONFIG.Size / 2 + offset.X,
			WT_RADAR_CONFIG.Size / 2 + offset.Y
		)
		entry.frame.BackgroundColor3 = getBlipColor(player)
		entry.button.Visible = true

		local blipSize = targetData.inJet and WT_RADAR_CONFIG.BlipSize + 2 or WT_RADAR_CONFIG.BlipSize
		entry.frame.Size = UDim2.fromOffset(blipSize, blipSize)

		local isLocked = lockedTarget == player
		entry.stroke.Thickness = isLocked and 2 or 1
		entry.stroke.Transparency = isLocked and 0 or 0.4
		entry.stroke.Color = isLocked and PHOSPHOR_BRIGHT or PHOSPHOR_BRIGHT
		entry.nameLabel.TextColor3 = isLocked and PHOSPHOR_BRIGHT or PHOSPHOR

		if entry.altLabel then
			local altDiff = targetData.altitude - localData.altitude
			if math.abs(altDiff) >= WT_RADAR_CONFIG.AltitudeThreshold then
				entry.altLabel.Visible = true
				entry.altLabel.Text = altDiff > 0 and "+" or "-"
			else
				entry.altLabel.Visible = false
			end
		end
	end
end

local function updateTargeting(dt)
	if not lockedTarget then
		lockReticle.Visible = false
		return
	end

	local targetData = getPlayerAircraftData(lockedTarget)
	local localData = getPlayerAircraftData(localPlayer)
	local camera = workspace.CurrentCamera

	if not targetData or not localData or not camera then
		setLockedTarget(nil)
		return
	end

	local distance = (targetData.position - localData.position).Magnitude
	if distance > WT_RADAR_CONFIG.MaxTrackRange then
		setLockedTarget(nil)
		return
	end

	local screenPos, onScreen = camera:WorldToViewportPoint(targetData.position)
	if onScreen then
		lockReticle.Visible = true
		lockReticle.Position = UDim2.fromOffset(screenPos.X, screenPos.Y)
	else
		lockReticle.Visible = false
	end

	if not WT_RADAR_CONFIG.TrackCamera then
		return
	end


	local camPos = camera.CFrame.Position
	local mouseDelta = UserInputService:GetMouseDelta()

	
	local sensitivity = 0.002
	local currentLook = camera.CFrame.LookVector
	local right = camera.CFrame.RightVector
	local up = Vector3.yAxis

	local yawRot = CFrame.fromAxisAngle(up, -mouseDelta.X * sensitivity)
	local pitchRot = CFrame.fromAxisAngle(right, -mouseDelta.Y * sensitivity)
	local mouseLook = (yawRot * pitchRot):VectorToWorldSpace(currentLook)

	
	local toTarget = (targetData.position - camPos).Unit
	local trackAlpha = math.clamp(WT_RADAR_CONFIG.TrackStrength * dt, 0, 1)
	local blendedLook = mouseLook:Lerp(toTarget, trackAlpha).Unit

	camera.CFrame = CFrame.lookAt(camPos, camPos + blendedLook)
end

local function updateSweep(dt)
	if not spinContainer then
		return
	end

	sweepAngle = (sweepAngle + dt * 120) % 360
	spinContainer.Rotation = sweepAngle

	
	for i, line in pairs(sweepLines) do
		if i > 0 then
			line.Rotation = -i * 6
		end
	end
end

local function onPlayerAdded(player)
	if player == localPlayer then
		return
	end
	createBlip(player)
end

for _, player in Players:GetPlayers() do
	onPlayerAdded(player)
end

Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(removeBlip)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then
		return
	end
	if input.KeyCode == WT_RADAR_CONFIG.ToggleKey then
		bezelFrame.Visible = not bezelFrame.Visible
	end
	if input.KeyCode == WT_RADAR_CONFIG.UnlockKey then
		setLockedTarget(nil)
	end
end)

RunService.RenderStepped:Connect(function(dt)
	updateRadar()
	updateTargeting(dt)
	updateSweep(dt)
end)

Features & Information

press M to toggle radar Press X or click the same blip again to unlock

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts