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!
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!
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?
I tried running it on a localscript, and it only showed to me.
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)
How would I do so? Run a script in starterGui? Or ServerScriptService?
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!
Alright, I’ll try to set something up! Thanks for the help!
Is there a way I can send data through the Remote event? Like let’s say, A name and another value. Is it possible?
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()
.
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)
Thank you, both of you two!
This has been a huge help!
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
You will have to remove the Player argument from the .OnClientEvent, as it is only passed for Server Events.
Could we see your code?
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.
It starts here. Then fires the data to the script.
I just need the Uncommon to transfer aswell rather than being nil.
Remove the plr argument from .OnClientEvent. It is not passed through in Client Events.
I’ll do that when I get back on studio, thanks for the help!
hey how would I make it so that I can change the color of the text using this method?