So I am trying to make a system where if you press a hotkey it will automatically say something for you so that mobile players and especially younger audiences have the ability to tap a button to say something without typing. I know, I could use a variety of different ways, such as playing a sound, using billboardguis, but I want them to chat specifically.
Basically, here is my script.
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k)
if k:lower()=="e" then
print('yes')
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("I am awesome","All")
end
end)
There seems to be nothing wrong with it until I use a .Chatted event detector script and it shows that it does not detect automatic chats. This can also be detrimental for things when you want to make a custom filter script, as exploiters can easily bypass them using this remote event.
My enquiry is I need a working solution to this. That’s all.
Sorry for replying after so long. I recently came across this feature and started to learn about it. My solution: why don’t you just add a script to detect when this RemoteEvent gets fired? It seems to work fine for me with both normal messages and messages sent via script.
I found a way to fire Player.Chatted, Here is the script:
local function chat(text)
local StarterGui = game:GetService('StarterGui')
local A = false
local ChatBar = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('Chat'):WaitForChild('Frame'):WaitForChild('ChatBarParentFrame'):WaitForChild('Frame'):WaitForChild('BoxFrame'):WaitForChild('Frame'):FindFirstChildOfClass('TextBox')
A = StarterGui:GetCore('ChatActive')
StarterGui:SetCore('ChatActive', true)
ChatBar:CaptureFocus()
ChatBar.Text = text
ChatBar.TextEditable = false
task.wait()
ChatBar:ReleaseFocus(true)
ChatBar.TextEditable = true
task.wait()
StarterGui:SetCore('ChatActive', A)
end
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(k)
if k:lower()=="e" then
print('yes')
chat("I am awesome")
end
end)