So basically I want to know if there's a way to tell if the person is currently chatting, whether they started chatting by pressing "/" or if they clicked on the chat gui. Is there any way of telling whether a player is currently in the process of chatting?
Thanks.
From some experimentation, I was able to make a script that would indicate if a player was typing in ROBLOX's CoreGui Chat. Due to the fact you can not receive the full hierarchy of the Chat Gui, I had to improvise with pcall
. Pcall
basically means protection call, it will run a function and return two values one being a bool to tell if it ran correctly or not, the other being a string that will report an error. That's why you may see local succ, err = pcall(function() end)
. I manipulated the script to indicate if a error would be given, if the function could not receive the hierarchy of the Gui object.
Without further ado, here is the script.
game:GetService('UserInputService').TextBoxFocused:connect(function(TextBox) local succ = pcall(function() TextBox:GetFullName() end) if not succ then print('User is typing.') end end) game:GetService('UserInputService').TextBoxFocusReleased:connect(function(TextBox) local succ = pcall(function() TextBox:GetFullName() end) if not succ then print('User quit typing.') end end)
In the script, TextBoxFocused
and TextBoxFocusReleased
events provide a instance value, being the TextBox taking input. With utilization of the first value pcall provides, I was able to tell if the function was successful or not, getting the TextBox's hierarchy. So, if not successful then print user is typing, when a TextBox is being focused, and similar concept to TextBoxFocusReleased.