Codectionary / Developer documentation / Luau

Highlight objects

Draw an outline or fill around a target object.

Why use Highlight?

Highlight is useful for selection feedback and interactable objects. Adornee chooses the target to render; it does not itself grant permission to interact with that target.

Try it in Roblox Studio

Create a Part named Selectable in Workspace. Put this Script in ServerScriptService and view it from a player camera.

Syntax

highlight.Adornee = target

Examples

Highlight objects

Outline a selectable part.

local target = workspace:WaitForChild("Selectable")
assert(target:IsA("BasePart"))
local highlight = Instance.new("Highlight")
highlight.Adornee = target
highlight.FillTransparency = 1
highlight.OutlineColor = Color3.fromRGB(255, 205, 0)
highlight.Parent = target
  1. Adornee points to the BasePart to highlight.
  2. FillTransparency = 1 hides the filled area while OutlineColor colors the border.
  3. The effect is visual; any selection or server validation must be implemented separately.

Best practices

  • Check contrast in bright and dark scenes.
  • Remove unused highlights when objects are destroyed.

Runtime & versions

Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.

Luau documentation

Specifications & further reading