How to display a chat message?

Hello, I don’t know how to display a chat message.

Here is my script:

local tcs = game:GetService("TextChatService")

tcs:DisplayBubble(script.Parent.Head,"Hello!")

It should work but in run mode no message appears from my npc!

Here is my properties panel for bubblechatconfig and players

I think this is due to bubblechat being off in players panel but idk how to turn it on!

FSR it works on my player and the rig if I run that code from the command bar but a script will not work! Even if I put the displaybubble method in a loop!!
image

Is dis a bug? Should I report it? I have access to @AllowBugReports.

2 Likes
local Chat = game:GetService("Chat")

Chat:Chat(script.Parent.Head,"Hello!")
3 Likes

It’s

local chat = game:GetService("Chat")
chat:Chat(path to head, "hi")
1 Like

Aw man, you answered before I did.

1 Like

@Fan_Len4ika1Tvink123

Nice try, it doesn’t work. And it’s outdated.

1 Like

It supposed to work and using Chat service for bubblechat is not outdated lol who said that?

Bubble Chat would appear for secs you can use ProximityPrompt or ClickDetector for it

local Rig = workspace.Rig
local ProximityPrompt = Rig.ProximityPrompt
local Chat = game:GetService("Chat")

ProximityPrompt.Triggerred:Connect(function()
Chat:Chat(Rig.Head, "Hello")
end)
1 Like

Literally everyone says it’s outdated and replaced by the method I used. Lol don’t you see the documentation?

Also I stated in the topic that it doesn’t work in a script as well. And, I also want it to work in run mode as I am using it to test an NPC system.

1 Like

Listen here, DO YOU also see the documentation?
You should be thankful that we’re trying to help you.

image

Where do you see, this method is outdated? Point me. I don’t see it.

I READED DOCUMENTATION TO ANSWER YOUR DUMB QUESTION. THERE’S NO DAMN SIGN IT’S OUTDATED. AND IT WORKS. PUT THIS DAMN CODE INSIDE COMMAND BAR WHILE PLAYTESTING, AND YOU’LL SEE YOUR STUPID NPC SAYS “HELLO”.

I’ve got really mad. If you read all documentations and you’re very smart, then don’t post here :person_shrugging:

Solve it by yourself.

1 Like

What are you so mad about? IIt seems I misworded that sentence. But anyways, roblox is recommending users to use TCS:DisplayBubble to move away from this going to be outdated service.

There is literally no need to be soo hyper about smthing ngl.

Lmao, chill out dude. seems like you also didn’t read my post. I want the npc to say that line in a script and not the command bar. Read the topic god damn it.

Also if you don’t have a solution to a question then just don’t even try to solve it. Literally it only leads to arguments.

2 Likes

have you tried in a game (not studio), because in my studio neither of the methods display anything but works fine in-game

1 Like

You said

I said

To proof this works. I don’t know what’s your problem. It works fine for me.

may we know Is your code run with normal script? or localscript?

I assume you put script directly in NPC rig and if it’s localscript it won’t run when it’s descendant of workspace.

and I am sure both Chat and DisplayBubble method will work fine.

:DisplayBubble only works on the client side, so you need a Script with RunContext set to Client if you are going to place it in workspace.

1 Like

Chat the service is deprecated.

I am using a server script.

I see, well why won’t chat:chat work then? Unless, that’s also client!?

Exactly.

Both are methods are client sided. You’ll need to run bot inside a LocalScript for them to work.

Are you sure? They used to work server sided previously.

So from what I’ve read about both functions and tested myself, Chat:Chat() should work on the server. Personally didn’t know that myself but hey I guess that’s good to know (even though it’s deprecated). However, TextChatService:DisplayBubble() is exclusive to the client and can only be executed from LocalScripts. This also means that bubble messages from DisplayBubble() will only be visible to client that is firing the function. If you want all players in the server to see the bubble messages using this method, you’ll need to use a RemoteEvent and fire it to all clients from the server and handle the request from the client by calling DisplayBubble().

Example:

-- Server
local ReplicatedStorage = game:GetService('ReplicatedStrorage')
local remote = ReplicatedStorage.RemoteEvent

local message = 'some message here'
local partOrCharacter = -- Whatever you're trying to display the message on.

remote:FireAllClients(partOrCharacter, message)
-- Client
local TextChatService = game:GetService('TextChatService')
local ReplicatedStorage = game:GetService('ReplicatedStrorage')
local remote = ReplicatedStorage:WaitForChild('RemoteEvent')

remote.OnClientEvent:Connect(function(partOrCharacter, message)
    TextChatService:DisplayBubble(partOrCharacter, message)
end)

Hope this helps!

2 Likes

Cool but not the answer. I want Chat:Chat to work on server. Ik it’s deprecated yet it shoudl work. But it doesnt.

What code are you currently using to call Chat()? As others have stated in this post, all you need for this function is the character’s head and the string message.

local Chat = game:GetService('Chat')
Chat:Chat(character.Head, 'Message content here.')