I'm trying to produce a chat bubble over a part. It should be straight forward, but the now deprecated Chat:Chat() doesn't work, expectedly, but the alternative, TextChatService:DisplayBubble() failing as well.
local part = game.Workspace.Part
game:GetService("TextChatService"):DisplayBubble(part, "Hello world!")
A surprising detail about TextChatService:DisplayBubble is that it only runs on client-sided scripts. This little detail was not under the DisplayBubble function documentation, but a small note in a guide about using Text Chat for NPCs.
So you need a LocalScript located in an appropriate container, or a Script whose RunContext is set to Client
.
But I was able to get it working with something like this :
Set up your workspace like this :
Then in your Script :
local tcs = game:GetService("TextChatService")
local prox = script.Parent.ProximityPrompt
local part = script.Parent
prox.Triggered:Connect(function(playerWhoTriggered : Player)
tcs:DisplayBubble(part, string.format("Hello %s", playerWhoTriggered.Name))
end)