TextChatService:DisplayBubble() does not work for NPCs

From the documentation for this method (TextChatService | Documentation - Roblox Creator Hub):

Displays a chat bubble above the provided partOrCharacter. Can display bubbles for non-player characters (NPCs).

However this is not the case. Reproduction:

  1. Open play solo
  2. Run the following command to display bubble chat on your own character model:
game:GetService("TextChatService"):DisplayBubble(game.Players.LocalPlayer.Character, "Test message")
  1. Duplicate your character model and rename it to something else (like “NPC”)
  2. Run the command again, but this time with the duplicated character model:
game:GetService("TextChatService"):DisplayBubble(workspace.NPC, "Test message")

The following error will be thrown:

5 Likes

May you upload that NPC’s model here? It would act like a reproduction file.

Might be intentional. You NEED to specify a part for NPCs, but providing a PLAYER character works.

Hi, thanks for reporting. @BackspaceRGB is correct–to display a message for an NPC, you should specify a part like its head. We’ll make the documentation clearer to reflect this.

1 Like

Hey no that is still a problem because if you specify just the head part you can’t make the chat bubble avoid accessories like it would if you specified the whole character. Sorry I should have mentioned that in my original post - that was the main reason I wanted to use the character rather than just the head part, which I was already aware of.

At the moment, if we want to avoid accessories, we have to do janky stuff like create an invisible part, weld it to the head, and manually compute the bounding box of the accessories and use that to set the size of chat bubble part welded to the head. This is annoying, and also inaccurate because the meshes do not necessarily fill or fit within the part bounding boxes of the accessories. I want to make use of Roblox’s own accessory avoidance code which is probably more efficient and more accurate, and I expected this API to provide that for me.

Thank you for flagging this, I have added in some clarification to the API to say that if you want to display bubbles for NPCs, you must provide a part on the character itself.

I’ll let @Clasifex respond to your specific use case, but again, thank you for flagging a need for more clear guidance here.

2 Likes

This seems like it should be fixed to work on models using the bounding box, rather than just documented as being janky.

If it works for player characters based on the bounding box - why should it not work for other models? Is this exception based on a humanoid existing? Is it only for models that are assigned as a player character?

2 Likes

Agreed that this behavior should ideally be adjusted so the API works as expected for humanoid characters. I filed a ticket in the team’s backlog–however this is currently not a priority for our team so I cannot promise a timeline for when it will be done.

5 Likes

i literally cannot get it to work with a specified part either, nothing shows up.

2 Likes

Same issue here, nothing shows up.

Using the method on the client for NPC characters. The adornee is set to the NPCs head.

I figured out it works with Chat:Chat() (service named just chat) although its deprecated/ being deprecated even though it’s the only one that actually works.

1 Like

I’m having this same issue. This just doesn’t work at all NPCs. I can’t find a workaround aside just using the old Chat service’s Chat function, like you said.

1 Like

Hey, could you post some sample code or an .rbxl? I am unable to reproduce this issue myself

I parented a Script with RunService=Client with the following source:

game:GetService("UserInputService").InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then
		game:GetService("TextChatService"):DisplayBubble(script.Parent, "testing 123")
	end
end)

pressFToBubble.rbxl (52.8 KB)

As for supporting Models, I’ve added and prioritized this in our backlog. We can take a look at this

1 Like

Yeah the API works as expected when called on parts - the repro you attempted was not following the instructions in the OP. The issue is that it doesn’t work on NPC character models (and bubbles on character models behave differently than bubbles on parts, so they aren’t easily interchangeable).

Thanks for prioritizing NPC support! The important part to get right with the Model support is avoiding accessories. When called on real character models, bubble chats avoid visually conflicting with accessories somehow. Calling the API on parts is hard right now because to avoid accessories we need to dynamically resize the adornee part, and come up with our own algorithm for computing the accessory bounding box or whatever (and accessory part bounding boxes don’t match the rendered accessory visuals if I remember correctly).

I’ve read the OP. I was more specifically talking about this thread

1 Like