ADVERTISEMENTREMOVE ADS

Aim Alert Detector

Universal script
3 months ago
Script preview thumbnail
Script Preview

Description

🌸 What this script is:
This is a GUI-based aim alert detector created by korpsebunny / thindoll. It shows a red warning popup on your screen whenever another player is aiming directly at you, helping you stay aware of threats with a simple, clear interface.

I USED CHATGPT FOR HELP

🧠 Main Features:

  • Aim Detection: Checks if any other player is looking toward your character within a 20° angle and 100 studs distance.

  • Player Names: Displays the names of all players currently aiming at you in the warning UI.

  • Warning UI: A red, easy-to-see text label that pops up at the top center of your screen when you're being targeted.

  • Continuous Monitoring: Runs every frame to keep you instantly informed of nearby threats.

💻 How it Works:

  • Loops through all other players in the game.

  • Uses their character’s facing direction (HumanoidRootPart LookVector) to approximate if they’re aiming at you.

  • Checks angle and distance to filter realistic aiming scenarios.

  • If detected, the UI becomes visible and shows who is aiming at you.

  • UI hides automatically when no one is aiming at you.

🔐 Safety Notes:

  • Script runs client-side only.

  • Works best in games where aiming direction correlates with character facing.

  • Cannot detect mouse aiming perfectly due to Roblox limitations; it uses a best-guess method.

💖 Made By:
korpsebunny (Me)
🌸 Please do not re-upload or redistribute without credit.

ADVERTISEMENTREMOVE ADS
74 Lines • 3.01 KiB
Raw
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)
ADVERTISEMENTREMOVE ADS

Comments

1 comment
to add a comment
ca

id reccomend claude.ai (sonnet 4) or google gemini 2.5 Pro while coding both have daily limits but seem to be better than chatgpt

0
0
ADVERTISEMENTREMOVE ADS