Advertisement
ProScripter29

Tracker Device Script

May 8th, 2023 (edited)
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | Gaming | 0 0
  1. local Object = game:GetObjects("rbxassetid://13384343617")[1]
  2.  
  3. Object.Name = "Tracker"
  4. Object.ToolTip = "Tracks both Players and NPCs"
  5. Object.Parent = game.Players.LocalPlayer.Backpack
  6.  
  7. local Enabled = true
  8. local MaxDistance = 300
  9.  
  10. Object.Equipped:Connect(function()
  11.     Enabled = true
  12.     while Enabled do
  13.         for i, Model in pairs(workspace:GetDescendants()) do
  14.             if Model:IsA("Model") then
  15.                 if Model:FindFirstChild("Humanoid") then
  16.                     if (not Model:FindFirstChild("PlayerHighlight")) and (not Model:FindFirstChild("NPCHighlight")) then
  17.                         local Player = game.Players:GetPlayerFromCharacter(Model)
  18.                         if Player then
  19.                             if Player == game.Players.LocalPlayer then
  20.                                 -- Ignore
  21.                             else
  22.                                 local Highlight = Object.Handle.PlayerHighlight:Clone()
  23.                                 Highlight.Parent = Player.Character
  24.                                 Highlight.Enabled = true
  25.                             end
  26.                         else
  27.                             local Highlight = Object.Handle.NPCHighlight:Clone()
  28.                             Highlight.Parent = Model
  29.                             Highlight.Enabled = true
  30.                         end
  31.                     end
  32.                 end
  33.             end
  34.         end
  35.         task.wait()
  36.     end
  37. end)
  38.  
  39. Object.Unequipped:Connect(function()
  40.     Enabled = false
  41.     for i, Model in pairs(workspace:GetDescendants()) do
  42.         if Model:IsA("Model") then
  43.             if Model:FindFirstChild("Humanoid") then
  44.                 if (Model:FindFirstChild("PlayerHighlight")) or (Model:FindFirstChild("NPCHighlight")) then
  45.                     Model:FindFirstChildOfClass("Highlight"):Destroy()
  46.                 end
  47.             end
  48.         end
  49.     end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement