Advertisement
rrixh

eli

Aug 17th, 2024 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.99 KB | None | 0 0
  1. --i need a locking script that works in hood spirit FFA, not a cam lock, make it a tool in my inventory, dot lock or bubble doesn't matter i just need to see who im locked on , works on mobile, also isnt detected
  2.  
  3.  
  4. local Players = game:GetService("Players")
  5. local UserInputService = game:GetService("UserInputService")
  6. local RunService = game:GetService("RunService")
  7. local TweenService = game:GetService("TweenService")
  8.  
  9. local LocalPlayer = Players.LocalPlayer
  10. local mouse = LocalPlayer:GetMouse()
  11.  
  12. local loxkedplr
  13. local lockDot
  14. local clickConnection
  15.  
  16. -- Function to create a red dot
  17. local function createRedDot()
  18.     local dot = Instance.new("Part")
  19.     dot.Size = Vector3.new(1.5, 1.5, 1.5) -- Slightly smaller than 🔴 emoji
  20.     dot.Shape = Enum.PartType.Ball
  21.   dot.BrickColor = BrickColor.new("Bright red")
  22.     dot.Anchored = true
  23.     dot.CanCollide = false
  24.     dot.Transparency = 0.5
  25.     dot.Parent = workspace
  26.     return dot
  27. end
  28.  
  29. local function uh(title, text)
  30.     game.StarterGui:SetCore("SendNotification", {
  31.         Title = title;
  32.         Text = text;
  33.         Duration = 3;
  34.     })
  35. end
  36.  
  37. -- Function to lock onto a player
  38. local function lockOntoPlayer(player)
  39.     loxkedplr = player
  40.     if lockDot then
  41.         lockDot:Destroy()
  42.     end
  43.     lockDot = createRedDot()
  44. uh("Locked On", "You are now locked onto " .. player.Name)
  45. end
  46.  
  47. -- Create the tool
  48. local tool = Instance.new("Tool")
  49. tool.Name = "Pinky loxk"
  50. tool.RequiresHandle = false
  51. tool.CanBeDropped = false
  52.  
  53. -- Equip and unequip events
  54. tool.Equipped:Connect(function()
  55.     clickConnection = mouse.Button1Down:Connect(function()
  56.  if mouse.Target and mouse.Target.Parent then
  57.   local klixkedplr = Players:GetPlayerFromCharacter(mouse.Target.Parent)
  58. if klixkedplr and klixkedplr ~= LocalPlayer then
  59.         lockOntoPlayer(klixkedplr)
  60.         end;end
  61.     end)
  62.  
  63.     UserInputService.TouchTap:Connect(function(touchPositions, uip)
  64.         if not uip then
  65. local touchPosition = touchPositions[1]
  66. local ray = workspace.CurrentCamera:ScreenPointToRay(touchPosition.X, touchPosition.Y)
  67. local hit, position = workspace:FindPartOnRay(ray, LocalPlayer.Character)
  68.  
  69.   if hit and hit.Parent then
  70.   local klixkedpl = Players:GetPlayerFromCharacter(hit.Parent)
  71.                 if klixkedpl and klixkedpl ~= LocalPlayer then
  72.                     lockOntoPlayer(klixkedpl)
  73.                 end
  74.             end
  75.         end
  76.     end)
  77. end)
  78.  
  79. tool.Unequipped:Connect(function()
  80.     if clickConnection then
  81.         clickConnection:Disconnect()
  82.     end
  83. end)
  84.  
  85. -- Follow the locked player with the red dot
  86. RunService.RenderStepped:Connect(function()
  87. if loxkedplr and loxkedplr.Character and lockDot then
  88.         local torso = loxkedplr.Character:FindFirstChild("HumanoidRootPart")
  89.         if torso then
  90.             local velocity = torso.Velocity
  91.             local prediction = torso.Position + velocity * 0.1
  92.             lockDot.Position = prediction + Vector3.new(0, 2, 0)
  93.         end
  94.     end
  95. end)
  96.  
  97. tool.Parent = LocalPlayer.Backpack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement