local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") -- Refresh times local PLAYER_REFRESH = 60 local ITEM_REFRESH = 20 -- Colors local COLORS = { Players = Color3.fromRGB(255, 255, 0), -- Yellow Medkit = Color3.fromRGB(255, 255, 255), -- White BloxyCola = Color3.fromRGB(255, 170, 0), -- Orange Generator = Color3.fromRGB(0, 170, 255) -- Blue } -- Clear highlights by tag name local function clearHighlights(tag) for _, obj in ipairs(Workspace:GetDescendants()) do if obj:IsA("Highlight") and obj.Name == tag then obj:Destroy() end end end -- Create highlight local function createHighlight(target, color, tag) if not target then return end local highlight = Instance.new("Highlight") highlight.Name = tag highlight.FillColor = color highlight.OutlineColor = color highlight.FillTransparency = 0.5 highlight.OutlineTransparency = 0 highlight.Adornee = target highlight.Parent = target end -- PLAYER LOOP (60s) task.spawn(function() while true do clearHighlights("PlayerHighlight") for _, player in ipairs(Players:GetPlayers()) do if player.Character then createHighlight(player.Character, COLORS.Players, "PlayerHighlight") end end task.wait(PLAYER_REFRESH) end end) -- ITEM LOOP (20s) task.spawn(function() while true do clearHighlights("ItemHighlight") for _, obj in ipairs(Workspace:GetDescendants()) do if obj:IsA("Model") or obj:IsA("BasePart") then if obj.Name == "Medkit" then createHighlight(obj, COLORS.Medkit, "ItemHighlight") elseif obj.Name == "BloxyCola" then createHighlight(obj, COLORS.BloxyCola, "ItemHighlight") elseif obj.Name == "Generator" then createHighlight(obj, COLORS.Generator, "ItemHighlight") end end end task.wait(ITEM_REFRESH) end end)