-- LocalScript (place in StarterPlayer > StarterPlayerScripts)
-- Client-side highlights for characters (for debugging / spectator / dev tools)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local localPlayer = Players.LocalPlayer
local HIGHLIGHT_NAME = "DevClientHighlight"
-- Config (tweak as needed)
local ALWAYS_ON_TOP = true -- set false if you want highlights occluded by world geometry
local FILL_TRANSPARENCY = 0.6
local OUTLINE_TRANSPARENCY = 0
local FILL_COLOR = Color3.fromRGB(255, 200, 60) -- golden-ish
local OUTLINE_COLOR = Color3.fromRGB(255, 100, 0)
-- Create highlight for a character
local function addHighlightToCharacter(character)
if not character then return end
-- avoid creating duplicates
if character:FindFirstChild(HIGHLIGHT_NAME) then return end
local highlight = Instance.new("Highlight")
highlight.Name = HIGHLIGHT_NAME
-- Adornee should be a Model or Instance to highlight — use the whole character model.
highlight.Adornee = character
highlight.Parent = character
highlight.FillTransparency = FILL_TRANSPARENCY
highlight.OutlineTransparency = OUTLINE_TRANSPARENCY
highlight.FillColor = FILL_COLOR
highlight.OutlineColor = OUTLINE_COLOR
if ALWAYS_ON_TOP then
-- DepthMode values: Occluded or AlwaysOnTop. AlwaysOnTop makes it visible through walls.
-- Use responsibly (for debugging or spectator only).
highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
else
highlight.DepthMode = Enum.HighlightDepthMode.Occluded
end
return highlight
end
-- Remove highlight from a character
local function removeHighlightFromCharacter(character)
if not character then return end
local h = character:FindFirstChild(HIGHLIGHT_NAME)
if h then h:Destroy() end
end
-- Attach handlers for a player
local function monitorPlayer(player)
-- If character already exists, add highlight
if player.Character then
addHighlightToCharacter(player.Character)
end
-- When character spawns
player.CharacterAdded:Connect(function(char)
-- small delay to let character initialize
char:WaitForChild("Humanoid", 5)
addHighlightToCharacter(char)
end)
-- Cleanup on character removal
player.CharacterRemoving:Connect(function(char)
-- highlight is parented to char so it gets removed, but just in case:
removeHighlightFromCharacter(char)
end)
end
-- Start for existing players (skip local player if you want)
for _, player in ipairs(Players:GetPlayers()) do
-- optional: skip local player if you don't want to highlight yourself
-- if player ~= localPlayer then monitorPlayer(player) end
monitorPlayer(player)
end
-- Monitor players joining later
Players.PlayerAdded:Connect(function(player)
monitorPlayer(player)
end)
-- Optional toggle: press "H" to toggle highlights on/off (client-side)
local highlightsEnabled = true
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.H then
highlightsEnabled = not highlightsEnabled
for _, plr in ipairs(Players:GetPlayers()) do
local char = plr.Character
if char then
if highlightsEnabled then
addHighlightToCharacter(char)
else
removeHighlightFromCharacter(char)
end
end
end
end
end)
Comments
It should work on all executers