
KeylessUniversal

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local radarSize = 100
local maxRange = 100
local gui, radar
local blips = {}
local lastPos = {}
-- 🔥 HARD RESET (thay nước sạch)
local function hardReset()
if gui then
gui:Destroy()
end
gui = nil
radar = nil
blips = {}
lastPos = {}
task.wait(0.1)
gui = Instance.new("ScreenGui")
gui.Name = "RadarGUI"
gui.Parent = LocalPlayer:WaitForChild("PlayerGui")
radar = Instance.new("Frame")
radar.Size = UDim2.new(0, radarSize, 0, radarSize)
radar.Position = UDim2.new(0.9, 0, 0.1, 0)
radar.AnchorPoint = Vector2.new(0.5,0.5)
radar.BackgroundColor3 = Color3.new(0,0,0)
radar.BackgroundTransparency = 0.5
radar.BorderSizePixel = 0
radar.ClipsDescendants = true
radar.Parent = gui
Instance.new("UICorner", radar).CornerRadius = UDim.new(1,0)
-- self
local selfBlip = Instance.new("Frame")
selfBlip.Size = UDim2.new(0,8,0,8)
selfBlip.AnchorPoint = Vector2.new(0.5,0.5)
selfBlip.Position = UDim2.new(0.5,0,0.5,0)
selfBlip.BackgroundColor3 = Color3.fromRGB(0,255,0)
selfBlip.BorderSizePixel = 0
selfBlip.ZIndex = 5
selfBlip.Parent = radar
Instance.new("UICorner", selfBlip).CornerRadius = UDim.new(1,0)
end
-- 🔥 CREATE BLIP
local function createBlip()
local b = Instance.new("Frame")
b.Size = UDim2.new(0,6,0,6)
b.AnchorPoint = Vector2.new(0.5,0.5)
b.BorderSizePixel = 0
b.ZIndex = 3
b.Parent = radar
Instance.new("UICorner", b).CornerRadius = UDim.new(1,0)
return b
end
-- 🔥 WATCHDOG (anti mất radar)
task.spawn(function()
while true do
task.wait(1)
local broken = false
if not gui or not gui.Parent then
broken = true
end
if not radar or not radar.Parent then
broken = true
end
if gui and gui.Parent ~= LocalPlayer:FindFirstChild("PlayerGui") then
broken = true
end
if broken then
hardReset()
end
end
end)
-- 🔥 RESET khi respawn / round
LocalPlayer.CharacterAdded:Connect(function()
hardReset()
end)
-- 🔥 FIX PLAYER LEAVE (quan trọng)
Players.PlayerRemoving:Connect(function(player)
if blips[player] then
blips[player]:Destroy()
blips[player] = nil
end
lastPos[player] = nil
end)
-- 🔥 MAIN LOOP
RunService.RenderStepped:Connect(function()
if not radar or not radar.Parent then return end
local char = LocalPlayer.Character
local root = char and char:FindFirstChild("HumanoidRootPart")
if not root then return end
local cam = Camera.CFrame
local angle = math.atan2(-cam.LookVector.X, -cam.LookVector.Z)
for _,p in ipairs(Players:GetPlayers()) do
if p ~= LocalPlayer then
if not blips[p] then
blips[p] = createBlip()
end
local r = p.Character and p.Character:FindFirstChild("HumanoidRootPart")
if r then
lastPos[p] = r.Position
end
local target = lastPos[p] or root.Position
local rel = target - root.Position
-- rotate theo camera
local c,s = math.cos(angle), math.sin(angle)
local x = rel.X * c - rel.Z * s
local z = rel.X * s + rel.Z * c
local dist = Vector2.new(x,z).Magnitude
local scale = (radarSize/2)/maxRange
local px,pz
if dist > maxRange then
local dir = Vector2.new(x,z).Unit
local edge = radarSize/2 - 5
px = dir.X * edge
pz = dir.Y * edge
else
px = x * scale
pz = z * scale
end
-- 🎯 màu theo TeamColor
local color = p.TeamColor and p.TeamColor.Color or Color3.new(1,1,1)
blips[p].BackgroundColor3 = color
blips[p].Position = UDim2.new(0.5, px, 0.5, pz)
end
end
end)No comments yet for this script.



