local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local LP = Players.LocalPlayer local Camera = workspace.CurrentCamera local MAX_DISTANCE = 250 local RAYS = 1000 local RAYS_PER_FRAME = 50 local MEMORY = 10 local black = false local scanning = false local points = {} local gui = Instance.new("ScreenGui", LP:WaitForChild("PlayerGui")) gui.Name = "Lidar" gui.DisplayOrder = -100 gui.IgnoreGuiInset = true local screen = Instance.new("Frame", gui) screen.Size = UDim2.fromScale(1,1) screen.BackgroundColor3 = Color3.new(0,0,0) screen.Visible = false local container = Instance.new("Frame", gui) container.Size = UDim2.fromScale(1,1) container.BackgroundTransparency = 1 container.Visible = false local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude local function clear() for _,p in ipairs(points) do p.gui:Destroy() end table.clear(points) container.Visible = false end local function add(pos, dist, color, text) local p = Instance.new("TextLabel", container) p.BackgroundTransparency = 1 p.Text = text or "▲" p.TextColor3 = color or Color3.new(1,1,1) p.TextScaled = true p.Size = UDim2.fromOffset( text and 8 or math.clamp(8 - dist / 50, 2, 6), text and 8 or math.clamp(8 - dist / 50, 2, 6) ) p.AnchorPoint = Vector2.new(.5,.5) table.insert(points,{ pos = pos, gui = p, time = os.clock() }) end local function scanPlayers() local origin = Camera.CFrame.Position for _,plr in ipairs(Players:GetPlayers()) do if plr ~= LP and plr.Character then local root = plr.Character:FindFirstChild("HumanoidRootPart") local hum = plr.Character:FindFirstChildOfClass("Humanoid") if root and hum and hum.Health > 0 then local offset = root.Position - origin if offset.Magnitude <= MAX_DISTANCE then local screenPos, visible = Camera:WorldToViewportPoint(root.Position) if visible and screenPos.Z > 0 then local hit = workspace:Raycast(origin,offset,params) if not hit or hit.Instance:IsDescendantOf(plr.Character) then add(root.Position,offset.Magnitude, plr.Team == LP.Team and Color3.fromRGB(50,255,100) or Color3.fromRGB(255,50,50), "◆") end end end end end end end local function scan() if scanning then return end scanning = true black = true screen.Visible = true container.Visible = true params.FilterDescendantsInstances = {LP.Character} scanPlayers() local origin = Camera.CFrame.Position for i = 1,RAYS do local yaw = math.rad(math.random(-5500,5500)/100) local pitch = math.rad(math.random(-3800,3800)/100) local dir = Camera.CFrame:VectorToWorldSpace( CFrame.Angles(pitch,yaw,0).LookVector ) local hit = workspace:Raycast(origin,dir * MAX_DISTANCE,params) if hit then add(hit.Position,(hit.Position-origin).Magnitude) end if i % RAYS_PER_FRAME == 0 then RunService.RenderStepped:Wait() end end scanning = false end RunService.RenderStepped:Connect(function() local now = os.clock() for i = #points,1,-1 do local p = points[i] local age = now - p.time if age >= MEMORY then p.gui:Destroy() table.remove(points,i) else local pos,visible = Camera:WorldToViewportPoint(p.pos) p.gui.Position = UDim2.fromOffset(pos.X,pos.Y) p.gui.Visible = visible and pos.Z > 0 if age > MEMORY - 2 then p.gui.TextTransparency = (age-(MEMORY-2))/2 end end end container.Visible = black or scanning end) UIS.InputBegan:Connect(function(input,processed) if processed then return end if input.KeyCode == Enum.KeyCode.N then black = not black screen.Visible = black if not black then clear() end elseif input.KeyCode == Enum.KeyCode.X then task.spawn(scan) end end)