ADVERTISEMENTREMOVE ADS
Item ESP
46,913 views

Script Preview
Description
ADVERTISEMENTREMOVE ADS
115 Lines • 3.93 KiB
_G.ItemESPSettings = _G.ItemESPSettings or {
["enabled"] = true,
["max_distance"] = 500,
["text_color"] = Color3.fromRGB(255, 255, 0),
["text_size"] = 12
}
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local CoreGui = game:GetService("CoreGui")
local ItemESPObjects = {}
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "ItemESP"
ScreenGui.Parent = CoreGui
local function createItemESP(item)
local esp = {}
esp.name = Instance.new("TextLabel")
esp.name.Size = UDim2.fromOffset(200, 20)
esp.name.BackgroundTransparency = 1
esp.name.TextColor3 = Color3.fromRGB(255, 255, 0)
esp.name.TextStrokeTransparency = 0
esp.name.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
esp.name.Font = Enum.Font.Code
esp.name.TextSize = 12
esp.name.TextXAlignment = Enum.TextXAlignment.Center
esp.name.Visible = false
esp.name.Parent = ScreenGui
ItemESPObjects[item] = esp
end
local function updateItemESP()
if not _G.ItemESPSettings.enabled then
for _, esp in pairs(ItemESPObjects) do
esp.name.Visible = false
end
return
end
for item, esp in pairs(ItemESPObjects) do
if not item or not item.Parent or not item.Parent.Parent then
esp.name:Destroy()
ItemESPObjects[item] = nil
end
end
for item, esp in pairs(ItemESPObjects) do
if item and item.Parent and item.Parent.Parent then
local itemPos
if item:IsA("Model") then
if item.PrimaryPart then
itemPos = item.PrimaryPart.Position
elseif item:FindFirstChildOfClass("BasePart") then
itemPos = item:FindFirstChildOfClass("BasePart").Position
end
elseif item:IsA("BasePart") then
itemPos = item.Position
end
if itemPos and LocalPlayer.Character and LocalPlayer.Character.HumanoidRootPart then
local distance = (LocalPlayer.Character.HumanoidRootPart.Position - itemPos).Magnitude
if distance <= _G.ItemESPSettings.max_distance then
local vector, onScreen = Camera:WorldToViewportPoint(itemPos)
if onScreen then
esp.name.Text = item.Name .. " [" .. math.floor(distance) .. "m]"
esp.name.Position = UDim2.fromOffset(vector.X - 100, vector.Y - 10)
esp.name.TextColor3 = _G.ItemESPSettings.text_color
esp.name.TextSize = _G.ItemESPSettings.text_size
esp.name.Visible = true
else
esp.name.Visible = false
end
else
esp.name.Visible = false
end
else
esp.name.Visible = false
end
else
esp.name.Visible = false
end
end
end
local function scanAllItems()
local itemsFolder = workspace:FindFirstChild("Items")
if itemsFolder then
for _, item in pairs(itemsFolder:GetChildren()) do
if (item:IsA("Model") or item:IsA("BasePart")) and not ItemESPObjects[item] then
createItemESP(item)
end
end
end
local charactersFolder = workspace:FindFirstChild("Characters")
if charactersFolder then
for _, item in pairs(charactersFolder:GetChildren()) do
if (item:IsA("Model") or item:IsA("BasePart")) and not ItemESPObjects[item] then
createItemESP(item)
end
end
end
end
scanAllItems()
RunService.Heartbeat:Connect(updateItemESP)
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS





Comments