First of all, let me explain what this does.
This will FORCEthe player to chat. This won't show in the actual chat but we'll get to that later.
(I've created a new version of this which does not break the chat. It's called "Forcing the .Chatted Event V2")
Note that this method basically overrides the event, you may need to make your own custom chat for this to work properly.
Wondering how to do that? I'm not gonna make a tutorial on it but I'll give a quick explanation. You can make your own chat, and then check the Chatted event and add to your chat. It might not be as good but it's the best I can think of.
**NOTE:**THIS ONLY WORKS ON THE CLIENT
First of all we need to create our script. We're gonna put a LocalScript named "ForceChat" or whatever you want inside of PlayerGui or StarterPlayer > StarterCharacterScripts!
Ok, now we're gonna write this code in the script
local Message = Instance.new("BindableEvent")
game.StarterGui:SetCore("CoreGuiChatConnections", {ChatWindow = {MessagePosted = Message}})
Message:Fire(";m Some Admin Commands")
If you have HD Admin and didn't change the prefix, you know the output ;D
This works by getting "CoreGuiChatConnections" and binding "MessagePosted" to a BindableEvent which we can then run BindableEvent:Fire("Your message") which will result in firing the .Chatted event.
Now to display it in chat it's a bit different then before.
What we need to do is add a message without calling the .Chatted event, and since the way we're doing it is the only way without a plugin or the command line (turns out there is, I've posted a new tutorial but it doesn't seem the Lua Learning moderators are active to accept it) we don't need to worry about that. (Not Command Prompt)
Roblox makes this easy for us because they add something in replicated storage called "DefaultChatSystemChatEvents" which has all we need for displaying it in the actual chat!
So here's what we're gonna add before that script:
game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(";m Some Admin Commands", "All" --[[The Channel (All)]])
This works because roblox automatically adds this folder inside of ReplicatedStorage, and it has a lot of RemoteFunctions and Events. The RemoteEvent we're using is SayMessageRequest. Note that SayMessageRequest DOES NOT fire the .Chatted event!
**Note:**You should put a wait before the code runs in case it runs too early before all of the needed stuff are there. I find 2-5 seconds good. (And because things like HDAdmin take a while to load on to the client for some reason)
game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(";m Some Admin Commands", "All" --[[The Channel (All)]])
local Message = Instance.new("BindableEvent")
game.StarterGui:SetCore("CoreGuiChatConnections", {ChatWindow = {MessagePosted = Message}})
Message:Fire(";m Some Admin Commands")
Forcing The Chatted Event