modify(e, 'custom_name')

View on GitHub

Syntax

modify(entity, 'custom_name', name)
modify(entity, 'custom_name', name, visible)

Sets the custom name of the entity. Without arguments - clears current custom name. Optional visible affects if the custom name is always visible, even through blocks.