Advertisement
AERQ1111

ROBLOX Forsaken Item ESP Script

Feb 26th, 2025 (edited)
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.95 KB | None | 0 0
  1. -- ROBLOX, Forsaken Item ESP
  2. -- i don't even play forsaken anymore lulz so i'm not updating this script (unless i want to)
  3. local RunService = game:GetService("RunService")
  4. local Players = game:GetService("Players")
  5. local Workspace = game:GetService("Workspace")
  6.  
  7. local player = Players.LocalPlayer
  8. local character = player.Character or player.CharacterAdded:Wait()
  9. local rootPart = character:WaitForChild("HumanoidRootPart") -- Get the player's position
  10.  
  11. local HIGHLIGHT_COLOR = Color3.fromRGB(0, 255, 0) -- Green Highlight [ADJUSTABLE]
  12. local TARGET_ITEMS = { "Medkit", "BloxyCola" } -- Items to highlight [YOU CAN ADD/CHANGE ITEMS]
  13. local MAX_DISTANCE = 150 -- Visibility range [ADJUSTABLE]
  14.  
  15. local itemFolder = Workspace:WaitForChild("Map"):WaitForChild("Ingame") -- Folder containing items
  16. local highlights = {} -- Store highlights for fading
  17.  
  18. -- Function to check if an item is being held by any player
  19. local function IsItemHeld(item)
  20.     for _, p in pairs(Players:GetPlayers()) do
  21.         local char = p.Character
  22.         if char then
  23.             local backpack = p:FindFirstChild("Backpack") -- Check inventory
  24.             local humanoid = char:FindFirstChildOfClass("Humanoid")
  25.            
  26.             -- Check if the tool is in the player's hands
  27.             if humanoid and humanoid:FindFirstChildOfClass("Tool") and humanoid:FindFirstChildOfClass("Tool").Name == item.Name then
  28.                 return true
  29.             end
  30.            
  31.             -- Check if the item is in the backpack
  32.             if backpack and backpack:FindFirstChild(item.Name) then
  33.                 return true
  34.             end
  35.         end
  36.     end
  37.     return false
  38. end
  39.  
  40. -- Function to create an ESP highlight
  41. local function CreateHighlight(item)
  42.     if highlights[item] then return end -- Prevent duplicate highlights
  43.  
  44.     local highlight = Instance.new("Highlight")
  45.     highlight.Name = "ItemHighlight"
  46.     highlight.Adornee = item
  47.     highlight.FillColor = HIGHLIGHT_COLOR
  48.     highlight.FillTransparency = 1 -- Start fully transparent
  49.     highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
  50.     highlight.OutlineTransparency = 1 -- Start invisible
  51.     highlight.Parent = item
  52.  
  53.     highlights[item] = highlight
  54. end
  55.  
  56. -- Function to update the highlight transparency based on distance
  57. local function UpdateESP()
  58.     if not rootPart then return end
  59.  
  60.     for _, item in pairs(itemFolder:GetChildren()) do
  61.         if table.find(TARGET_ITEMS, item.Name) and item:IsA("Model") then
  62.             local primaryPart = item.PrimaryPart or item:FindFirstChildWhichIsA("BasePart")
  63.             if primaryPart then
  64.                 local distance = (primaryPart.Position - rootPart.Position).Magnitude
  65.                 local highlight = highlights[item]
  66.  
  67.                 -- Check if the item is being held
  68.                 if IsItemHeld(item) then
  69.                     -- Remove highlight if it's being held
  70.                     if highlight then
  71.                         highlight:Destroy()
  72.                         highlights[item] = nil
  73.                     end
  74.                 else
  75.                     -- Create highlight if it's not held
  76.                     if not highlight then
  77.                         CreateHighlight(item)
  78.                         highlight = highlights[item]
  79.                     end
  80.  
  81.                     -- Smooth fading effect in and out of range
  82.                     local targetTransparency = (distance > MAX_DISTANCE) and 1 or 0.5
  83.                     local targetOutlineTransparency = (distance > MAX_DISTANCE) and 1 or 0
  84.  
  85.                     -- Adjust thingies for smooth fading
  86.                     highlight.FillTransparency = highlight.FillTransparency + (targetTransparency - highlight.FillTransparency) * 0.1
  87.                     highlight.OutlineTransparency = highlight.OutlineTransparency + (targetOutlineTransparency - highlight.OutlineTransparency) * 0.1
  88.                 end
  89.             end
  90.         end
  91.     end
  92. end
  93.  
  94. RunService.RenderStepped:Connect(UpdateESP)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement