local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) screenGui.Name = "AimWarningGui" local textLabel = Instance.new("TextLabel", screenGui) textLabel.Size = UDim2.new(0, 200, 0, 50) textLabel.Position = UDim2.new(0.5, -100, 0.1, 0) textLabel.BackgroundColor3 = Color3.new(1, 0, 0) textLabel.TextColor3 = Color3.new(1, 1, 1) textLabel.TextScaled = true textLabel.Text = "⚠ Someone is aiming at you!" textLabel.Visible = false textLabel.Font = Enum.Font.SourceSansBold local function isAimingAtMe(otherPlayer) if otherPlayer.Character and otherPlayer.Character:FindFirstChild("Head") and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then local head = otherPlayer.Character.Head local hrp = player.Character.HumanoidRootPart -- Raycast from otherPlayer's head or camera to their mouse direction (approximate) -- We approximate the aim direction by using their camera's lookVector if available local otherCamera = workspace.CurrentCamera if otherPlayer == player then return false end -- Get the mouse hit position of the other player using their mouse location -- Unfortunately we can't get other player's mouse position directly in a LocalScript -- So we approximate by checking if player's HRP is in front of otherPlayer's camera and in their FOV local character = otherPlayer.Character local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if not humanoidRootPart then return false end local camCFrame = (otherPlayer == player) and camera.CFrame or humanoidRootPart.CFrame -- fallback -- Vector from other player to you local dirToPlayer = (hrp.Position - humanoidRootPart.Position).Unit local lookVector = humanoidRootPart.CFrame.LookVector -- Angle between lookVector and direction to you local dot = lookVector:Dot(dirToPlayer) -- Check if within approx 20 degrees (cos 20° ≈ 0.94) if dot > 0.94 then -- Check distance too local dist = (hrp.Position - humanoidRootPart.Position).Magnitude if dist < 100 then -- only if close enough return true end end end return false end RunService.Heartbeat:Connect(function() local aimingPlayers = {} for _, otherPlayer in pairs(Players:GetPlayers()) do if otherPlayer ~= player then if isAimingAtMe(otherPlayer) then table.insert(aimingPlayers, otherPlayer.Name) end end end if #aimingPlayers > 0 then textLabel.Visible = true textLabel.Text = "⚠ " .. table.concat(aimingPlayers, ", ") .. " is aiming at you!" else textLabel.Visible = false end end)