I’ve been trying to make communication with a phone and textchatservice display bubbles and everything i’ve tried hasn’t worked very well. Using TextChatService OnIncomingMessage fires every message so it’ll send in messages from players not in the call and from the system, ChatService is deprecated so I’d prefer not to use it and Player.Chatted isn’t firing when I call it from a localscript.
If anyone knows how or if you need more info, let me know! This has been racking my brain for ages.
I don’t need it to be as I have two seperate scripts within my phone tool that are local and server side. Though I believe I’ll need to send stuff to a remote event to send messages?
Previously I just used a fireserver with who I was sending it to in the parameters. Then an onserverevent or onclient event to check for the event firing.
Player.Chatted only fires on the server. For some strange reason.
Anyway, I’d recommend using TextChatService.MessageReceived. .OnIncomingMessage is only generally for things like chat tags and the such, which need to modify the message. MessageReceived is when the message has been delivered.
it also respects this (but so does OnIncomingMessage), but you can use that to control who gets it.
OnIncomingMessage provided it too - it’s a part of the TextChatMessage!
TextChatService.MessageReceived:Connect(function(msg: TextChatMessage)
local sender = msg.TextSource and
msg.TextSource.UserId and --included this cuz idk if that can be nil if sent by the system
Players:GetPlayerByUserId(message.TextSource.UserId) --do not want this erroring
if (not sender) then print("System message!") end
--etc.
end)