Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ROBLOX, Forsaken Item ESP
- -- i don't even play forsaken anymore lulz so i'm not updating this script (unless i want to)
- local RunService = game:GetService("RunService")
- local Players = game:GetService("Players")
- local Workspace = game:GetService("Workspace")
- local player = Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local rootPart = character:WaitForChild("HumanoidRootPart") -- Get the player's position
- local HIGHLIGHT_COLOR = Color3.fromRGB(0, 255, 0) -- Green Highlight [ADJUSTABLE]
- local TARGET_ITEMS = { "Medkit", "BloxyCola" } -- Items to highlight [YOU CAN ADD/CHANGE ITEMS]
- local MAX_DISTANCE = 150 -- Visibility range [ADJUSTABLE]
- local itemFolder = Workspace:WaitForChild("Map"):WaitForChild("Ingame") -- Folder containing items
- local highlights = {} -- Store highlights for fading
- -- Function to check if an item is being held by any player
- local function IsItemHeld(item)
- for _, p in pairs(Players:GetPlayers()) do
- local char = p.Character
- if char then
- local backpack = p:FindFirstChild("Backpack") -- Check inventory
- local humanoid = char:FindFirstChildOfClass("Humanoid")
- -- Check if the tool is in the player's hands
- if humanoid and humanoid:FindFirstChildOfClass("Tool") and humanoid:FindFirstChildOfClass("Tool").Name == item.Name then
- return true
- end
- -- Check if the item is in the backpack
- if backpack and backpack:FindFirstChild(item.Name) then
- return true
- end
- end
- end
- return false
- end
- -- Function to create an ESP highlight
- local function CreateHighlight(item)
- if highlights[item] then return end -- Prevent duplicate highlights
- local highlight = Instance.new("Highlight")
- highlight.Name = "ItemHighlight"
- highlight.Adornee = item
- highlight.FillColor = HIGHLIGHT_COLOR
- highlight.FillTransparency = 1 -- Start fully transparent
- highlight.OutlineColor = Color3.fromRGB(255, 255, 255)
- highlight.OutlineTransparency = 1 -- Start invisible
- highlight.Parent = item
- highlights[item] = highlight
- end
- -- Function to update the highlight transparency based on distance
- local function UpdateESP()
- if not rootPart then return end
- for _, item in pairs(itemFolder:GetChildren()) do
- if table.find(TARGET_ITEMS, item.Name) and item:IsA("Model") then
- local primaryPart = item.PrimaryPart or item:FindFirstChildWhichIsA("BasePart")
- if primaryPart then
- local distance = (primaryPart.Position - rootPart.Position).Magnitude
- local highlight = highlights[item]
- -- Check if the item is being held
- if IsItemHeld(item) then
- -- Remove highlight if it's being held
- if highlight then
- highlight:Destroy()
- highlights[item] = nil
- end
- else
- -- Create highlight if it's not held
- if not highlight then
- CreateHighlight(item)
- highlight = highlights[item]
- end
- -- Smooth fading effect in and out of range
- local targetTransparency = (distance > MAX_DISTANCE) and 1 or 0.5
- local targetOutlineTransparency = (distance > MAX_DISTANCE) and 1 or 0
- -- Adjust thingies for smooth fading
- highlight.FillTransparency = highlight.FillTransparency + (targetTransparency - highlight.FillTransparency) * 0.1
- highlight.OutlineTransparency = highlight.OutlineTransparency + (targetOutlineTransparency - highlight.OutlineTransparency) * 0.1
- end
- end
- end
- end
- end
- RunService.RenderStepped:Connect(UpdateESP)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement