The simplest method is to display the text only to the owner of the unit:
Set pgrp = (Player group((Owner of unit)))
Floating Text - Hide (Last created floating text) for (All players)
Floating Text - Show (Last created floating text) for pgrp
Custom script: call DestroyForce(udg_pgrp)
Custom script: set udg_pgrp = null
If you want to display it for players that have vision over the unit, use GetLocalPlayer() and IsUnitVisible().