System Chat Message

Hello!

Is there a way to make a system chat message fire from a remote function/event?

If so, how would I do it?
Thanks!

14 Likes

To send a system message, you can use StarterGui:SetCore().

game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = "[SYSTEM] Hello World", Color = Color3.fromRGB( 255,0,0 ), Font = Enum.Font.Arial, FontSize = Enum.FontSize.Size24 } )

I’m not sure why you would need a RemoteEvent, since this function works on both the client, and the server. Can you clarify on that?

21 Likes

I tried running it on a localscript, and it only showed to me.

1 Like

Exactly. Running it in a LocalScript will make the message only appear locally in your chat, while running it in a Server Script, will replicate the chat to everyone.

If you want to transfer a message to be sent from the Server, you can use a RemoteEvent to transfer the message command, and then post it.
Just make sure to use FilterStringAsync on the Server, so you are abiding by TOS.

local TextService = game:GetService("TextService")
local filteredTextResult = TextService:FilterStringAsync(text, fromPlayerId)
21 Likes

How would I do so? Run a script in starterGui? Or ServerScriptService?

2 Likes

You could use one LocalScript, and one ServerScript, to handle each side of the system. If you look through the Developer Hub article on RemoteEvents that I linked above, there should be examples for how to use them.

If you have trouble with creating the system, just let me know!

1 Like

Alright, I’ll try to set something up! Thanks for the help!

2 Likes

Is there a way I can send data through the Remote event? Like let’s say, A name and another value. Is it possible?

1 Like

Yes, you can send basically anything through a RemoteEvent like a table or if you want like separate variables.

--Client
RemoteEvent:FireServer({name = "name", value = 0})
--Server
RemoteEvent.OnServerEvent:Connect(function(player, data)
    print(data.name, data.value)
end)

It will be the same for :FireClient().

5 Likes

Yes, of course! You can pass parameters into FireServer that can be viewed from the other end.

--client
RemoteEvent:FireServer(Name, OtherValue)

--server
RemoteEvent.OnServerEvent:Connect(function(PlayerWhoTheEventCameFrom, Name, OtherValue)

end)
4 Likes

Thank you, both of you two!
This has been a huge help!

3 Likes

When I try to fire a value from the server to the client, the value returns nil. I’m doing the same method you have explained above. : D

1 Like

You will have to remove the Player argument from the .OnClientEvent, as it is only passed for Server Events.

Could we see your code?

1 Like

So I’m trying to pass two values through these events.
The to values are names.

They start with a Localscript, Which goes to a script, which then goes to everyone else.
Screen Shot 2020-09-10 at 10.27.56 AM
It starts here. Then fires the data to the script.


This is the script. The print prints, Uncommon Item.


And this is the final result.
it prints, Item, nil

I just need the Uncommon to transfer aswell rather than being nil.

1 Like

Remove the plr argument from .OnClientEvent. It is not passed through in Client Events.

2 Likes


Bottom 2 lines. : p
I just took out the play-
OOOH
I never removed the plr from the script

I’ll do that when I get back on studio, thanks for the help!

1 Like

hey how would I make it so that I can change the color of the text using this method?