I want to make player from local player chat message as if player typed and sent it. I don’t want to create custom message on server, or make it client-sided.
I found alot of forum posts which were:
1.Outdated
2. Used hacky way of achieving this.
I want to make player from local player chat message as if player typed and sent it. I don’t want to create custom message on server, or make it client-sided.
I found alot of forum posts which were:
1.Outdated
2. Used hacky way of achieving this.
I found this before, but I was confused as to how to utilize this function, could you explain further?
I’m working on voice commands system with chat messages and I wanted the least hacky method for this.
As @SownMoney707431 pointed out, you can use the SendAsync
method on a TextChannel
to make the local player send a message that will appear as a chat bubble and in the chat window.
For example, if you wanted to send a message to everyone in the server, you would do something like this:
local textchannel = game:GetService("TextChatService"):WaitForChild("TextChannels"):WaitForChild("RBXGeneral") -- References the general TextChannel
local message = "Hello, world!" -- The message that the local player will say
textchannel:SendAsync(message) -- Makes the player say "Hello, world!"
You can also send the default chat commands, for example, if you want to clear the local player’s chats in the chat window, you would send the message /clear
, or if you want to whisper to someone, you would do /whisper [username] [message]
.