qnidnqwid

Directional Aiming VBL script

Jan 1st, 2026 (edited)
332
0
84 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.39 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local LocalPlayer = Players.LocalPlayer
  4.  
  5. -----------------------------------------------------------
  6. -- SETTINGS
  7. -----------------------------------------------------------
  8. local ARROW_DISTANCE = 21
  9.  
  10. -- LINE VISIBILITY (dark & thick)
  11. local COLOR_DARK = Color3.fromRGB(20, 0, 0) -- almost black red
  12. local WIDTH_START = 2.4    -- near head
  13. local WIDTH_END = 0.3      -- far end
  14.  
  15. -----------------------------------------------------------
  16.  
  17. function createDirectionalESP(character)
  18.     local head = character:WaitForChild("Head")
  19.     local humanoid = character:WaitForChild("Humanoid")
  20.     local root = character:WaitForChild("HumanoidRootPart")
  21.  
  22.     -----------------------------------------------------------
  23.     -- Attachments
  24.     -----------------------------------------------------------
  25.     local att1 = Instance.new("Attachment")
  26.     att1.Name = "DirESP_Head"
  27.     att1.Parent = head
  28.  
  29.     local att2 = Instance.new("Attachment")
  30.     att2.Name = "DirESP_End"
  31.     att2.Parent = head
  32.  
  33.     -----------------------------------------------------------
  34.     -- Beam (AIM LINE)
  35.     -----------------------------------------------------------
  36.     local beam = Instance.new("Beam")
  37.     beam.Name = "DirectionalBeam"
  38.  
  39.     -- DARK / SOLID
  40.     beam.Color = ColorSequence.new(COLOR_DARK)
  41.     beam.Transparency = NumberSequence.new(0)
  42.  
  43.     -- THICK
  44.     beam.Width0 = WIDTH_START
  45.     beam.Width1 = WIDTH_END
  46.  
  47.     -- IGNORE LIGHTING
  48.     beam.LightEmission = 0
  49.     beam.LightInfluence = 0
  50.  
  51.     -- ALWAYS VISIBLE
  52.     beam.FaceCamera = true
  53.     beam.ZOffset = -2
  54.  
  55.     beam.Attachment0 = att1
  56.     beam.Attachment1 = att2
  57.     beam.Parent = head
  58.  
  59.     -----------------------------------------------------------
  60.     -- Freeze direction while jumping
  61.     -----------------------------------------------------------
  62.     local frozenDir
  63.     local isFrozen = false
  64.  
  65.     humanoid.StateChanged:Connect(function(_, newState)
  66.         if newState == Enum.HumanoidStateType.Jumping then
  67.             local look = root.CFrame.LookVector
  68.             frozenDir = Vector3.new(look.X, 0, look.Z).Unit
  69.             isFrozen = true
  70.  
  71.         elseif newState == Enum.HumanoidStateType.Landed then
  72.             isFrozen = false
  73.         end
  74.     end)
  75.  
  76.     -----------------------------------------------------------
  77.     -- Update loop
  78.     -----------------------------------------------------------
  79.     RunService.RenderStepped:Connect(function()
  80.         if not character.Parent then return end
  81.  
  82.         local dir
  83.         if isFrozen and frozenDir then
  84.             dir = frozenDir
  85.         else
  86.             local look = root.CFrame.LookVector
  87.             dir = Vector3.new(look.X, 0, look.Z).Unit
  88.         end
  89.  
  90.         att2.WorldPosition = head.Position + dir * ARROW_DISTANCE
  91.     end)
  92. end
  93.  
  94. -----------------------------------------------------------
  95. -- Apply ESP to all non-local players
  96. -----------------------------------------------------------
  97.  
  98. Players.PlayerAdded:Connect(function(plr)
  99.     if plr ~= LocalPlayer then
  100.         plr.CharacterAdded:Connect(function(char)
  101.             task.wait(1)
  102.             createDirectionalESP(char)
  103.         end)
  104.     end
  105. end)
  106.  
  107. for _, plr in ipairs(Players:GetPlayers()) do
  108.     if plr ~= LocalPlayer and plr.Character then
  109.         createDirectionalESP(plr.Character)
  110.     end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment