Add a object then have a interactive trigger display text

I would like to display some text when an interactive trigger is acted upon that is attached to an object. I am not sure what to do

It'll look something like this below. Note: You'll need to create a core object reference within the scripts props called "uiTextObj" if you are using my code and also make sure the script + ui element is within a client context.

local trigger = script.parent
local propUiTextObj = script:GetCustomProperty("uiTextObj"):WaitForObject()

function OnInteracted(whichTrigger, other)
  if other:IsA("Player") then
	propUiTextObj.visibility = Visibility.INHERIT


The key line being: propUiTextObj.visibility = Visibility.INHERIT
You can also use Visibility.FORCE_ON but I prefer to inherit as it'll abide by the hierarchies visibility.

You can also use a World Text object, which does not need to be in a client context. You place that in the world and set it's text following examples here:

1 Like

But if I do it that way is it bound to a trigger or just display the text?

There's actually a text trigger script in the Community Content library that you can import into your game, that does exactly what you're talking about. In the editor, open the tab for Community Content and search for "Trigger Display Popup Text" by LazyGobCody. You can import this into your game and edit it the way you like image

That worked, but the text is WAY to big and the color cannot be seen against the background.. any fixes for that I tried changing the color but no luck