LSL hover text script (and how to remove floating text)
Free LSL hover text script for Second Life: show floating text above any object in any colour, use several lines, and remove stuck text for good.
Hover text is the floating text above signs, vendors, tip jars and gift boxes. This tiny script sets it in any colour and with as many lines as you need. It also answers a classic question: how do I get rid of floating text that stays after the script is gone?
// Hover Text - free LSL script from WhatSL (https://whatsl.com/scripts/lsl-hover-text-script)
// Free to use, change and put in your own creations, also ones you sell.
//
// Shows floating text above the object. Use \n for a new line.
// The text stays on the prim even if you delete this script. To remove it, set HOVER_TEXT to ""
// and save the script once.
string HOVER_TEXT = "Welcome!\nTouch the sign for a free gift";
vector TEXT_COLOR = <1.0, 1.0, 1.0>; // red, green, blue from 0.0 to 1.0 (white here)
float TEXT_ALPHA = 1.0; // 1.0 = solid, 0.5 = half see-through
default
{
state_entry()
{
llSetText(HOVER_TEXT, TEXT_COLOR, TEXT_ALPHA);
}
}
Free to use, change and put in your own creations, also ones you sell.
How to set it up
- Put the script in the object and change HOVER_TEXT to your words.
- Use \n inside the text to start a new line.
- Save. The text appears above the object.
Settings
- HOVER_TEXT: your text. Keep it short; long text is hard to read from a distance.
- TEXT_COLOR: red, green and blue values from 0.0 to 1.0. <1.0, 0.85, 0.3> is gold, <0.4, 0.8, 1.0> is light blue.
- TEXT_ALPHA: 1.0 is solid, lower values make the text see-through.
How to remove floating text
Hover text is a setting of the prim, not of the script, so it stays when you delete the script. To remove it, set HOVER_TEXT to "" (two quotes with nothing between), save the script once, then delete the script.
Frequently asked questions
How far away can people see hover text?
Hover text is visible from a moderate distance and fades further away. Important information should also be on a texture or in a notecard.
Can I make the text change?
Yes. Call llSetText again with new text, for example from a timer or a touch event.
Does hover text cause lag?
No. It is one prim setting and costs almost nothing.