-- Executor client script: prioritized gold text, no background, smaller text
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
if not player then
warn("LocalPlayer not found. Run this on the client.")
return
end
local playerGui = player:WaitForChild("PlayerGui", 5)
if not playerGui then
warn("PlayerGui not found.")
return
end
local folder = Workspace:FindFirstChild("items") or Workspace:FindFirstChild("Items")
if not folder then
warn("No folder named 'items' or 'Items' found in Workspace.")
return
end
-- Config
local SELECTIONBOX_NAME = "Exec_SelectionBox"
local BILLBOARD_NAME = "Exec_Billboard"
local PROCESS_DESCENDANTS = false -- top-level children only (safer)
local TEXT_SIZE = 18 -- smaller text size
local GOLD_COLOR = Color3.fromRGB(255, 200, 0)
local DEFAULT_TEXT_COLOR = Color3.fromRGB(255, 255, 255)
-- Prioritized names (case-insensitive)
local prioritized = {
["bull's essence"] = true,
["true power"] = true,
["potion of strength"] = true,
["boba"] = true,
}
local function isBasePart(obj) return obj and obj:IsA("BasePart") end
local function getAttachPartForModel(model)
if not model or not model:IsA("Model") then return nil end
if model.PrimaryPart and isBasePart(model.PrimaryPart) then return model.PrimaryPart end
for _, d in ipairs(model:GetDescendants()) do
if isBasePart(d) then return d end
end
return nil
end
local function safeNew(className)
local ok, inst = pcall(Instance.new, className)
if ok then return inst end
return nil
end
-- Track visuals: attachPart -> {selectionBox, billboard}
local visuals = {}
local function destroyVisualsForPart(part)
local entry = visuals[part]
if not entry then return end
for _, obj in ipairs(entry) do
pcall(function() if obj and obj.Parent then obj:Destroy() end end)
end
visuals[part] = nil
print("DEBUG: destroyed visuals for", part:GetFullName())
end
local function createSelectionBox(part, useGold)
local sb = safeNew("SelectionBox")
if not sb then return nil end
sb.Name = SELECTIONBOX_NAME
pcall(function() sb.Adornee = part end)
sb.LineThickness = 0.06
sb.SurfaceTransparency = 1
sb.Color3 = useGold and GOLD_COLOR or Color3.fromRGB(255, 170, 0)
local ok, err = pcall(function() sb.Parent = Workspace end)
if not ok then
pcall(function() sb:Destroy() end)
return nil
end
return sb
end
local function createBillboard(part, labelText, useGold)
local bg = safeNew("BillboardGui")
if not bg then return nil end
bg.Name = BILLBOARD_NAME
pcall(function() bg.Adornee = part end)
bg.AlwaysOnTop = true
bg.Size = UDim2.new(0, 160, 0, 28)
bg.StudsOffset = Vector3.new(0, (part.Size.Y or 2) / 2 + 0.9, 0)
bg.MaxDistance = 1000
bg.LightInfluence = 0
local ok, err = pcall(function() bg.Parent = playerGui end)
if not ok then
pcall(function() bg:Destroy() end)
return nil
end
-- Only text, no background
local label = safeNew("TextLabel")
if not label then
pcall(function() bg:Destroy() end)
return nil
end
label.Name = "Label"
label.Size = UDim2.new(1, 0, 1, 0)
label.Position = UDim2.new(0, 0, 0, 0)
label.BackgroundTransparency = 1 -- no background
label.Text = labelText or part.Name
label.TextColor3 = useGold and GOLD_COLOR or DEFAULT_TEXT_COLOR
label.TextStrokeColor3 = Color3.fromRGB(0,0,0)
label.TextStrokeTransparency = 0 -- stroke visible for readability
label.Font = Enum.Font.GothamBold
label.TextScaled = false
label.TextSize = TEXT_SIZE
label.Parent = bg
-- Keep offset updated if part size changes
part:GetPropertyChangedSignal("Size"):Connect(function()
if bg and bg.Parent then
bg.StudsOffset = Vector3.new(0, part.Size.Y / 2 + 0.9, 0)
end
end)
-- Keep label synced to model/part name
part:GetPropertyChangedSignal("Name"):Connect(function()
if label and label.Parent then
label.Text = labelText or part.Name
end
end)
return bg
end
local function createVisualsForAttach(part, labelText)
if not isBasePart(part) then return end
if visuals[part] then return end
local nameLower = (labelText or part.Name):lower()
local useGold = prioritized[nameLower] == true
local created = {}
-- Create SelectionBox (visible outline)
local sb = createSelectionBox(part, useGold)
if sb then table.insert(created, sb); print("DEBUG: SelectionBox created for", part:GetFullName()) end
-- Create Billboard label (text only)
local bb = createBillboard(part, labelText, useGold)
if bb then table.insert(created, bb); print("DEBUG: Billboard created for", part:GetFullName(), "gold:", tostring(useGold)) end
if #created > 0 then
visuals[part] = created
else
print("DEBUG: Failed to create visuals for", part:GetFullName())
end
end
local function applyToInstance(inst)
if not inst then return end
if inst:IsA("Model") then
local attach = getAttachPartForModel(inst)
if attach then
createVisualsForAttach(attach, inst.Name)
end
elseif isBasePart(inst) then
createVisualsForAttach(inst, inst.Name)
end
end
-- Initial pass: top-level children
for _, child in ipairs(folder:GetChildren()) do
pcall(function() applyToInstance(child) end)
end
-- React to new additions
folder.DescendantAdded:Connect(function(desc)
task.wait(0.03)
pcall(function() applyToInstance(desc) end)
end)
-- Clean up when removed
folder.DescendantRemoving:Connect(function(desc)
if desc:IsA("BasePart") then
destroyVisualsForPart(desc)
elseif desc:IsA("Model") then
local attach = getAttachPartForModel(desc)
if attach then destroyVisualsForPart(attach) end
end
end)
print("DEBUG: Prioritized visuals initialized for folder:", folder:GetFullName())
Comments
No comments yet
Be the first to share your thoughts!