Currently I am working on a custom bubble chat system for a project, as the normal bubble chat does not work with the game’s characters.
I have set up a player.Chatted function to see when the player chats, but I don’t want the function to fire if the PlayerChatType is 2 (a whisper chat), as I want whispers to be private.
The problem is simply that I don’t know how the PlayerChatType works, and was wondering if anybody could explain how to use it.
I’ve tried looking up how to detect if a message is a whisper or not, but I had no luck.
I found what it can do, I just don’t understand how to use it.
I haven’t worked much with chat systems and I couldn’t find a way to use PlayerChatType as the second recipient argument always returns nil. You could counter this by checking the first argument chatted. Whenever a player is chatting through a whisper, it sets /w at the beginning or as a team, it sets /t at the beginning.
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if (string.match(Message, '^/w')) then
print('Whisper Detected')
elseif (string.match(Message, '^/t')) then
print('Team Detected')
else
print('Global Detected')
end
end)
end)
Hence this could flag any message at the beginning with either /w or /t as a whispered message or team message.
I thought about that too, but the problem with it is that it only does it when you start a whisper conversation, from there it just counts them as normal messages.