I am trying to get a Part to display a specific server text message in the player’s chatbox whenever a specific Part is touched. I know how to display server chat messages using StarterGui but I do not know how to get this function to work or communicate with whenever a Part in Workspace is .Touched.
StarterGui script:
local function ChatMessage(text)
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(text)
end
use a local script to detect “.Touched” that fires a remote event, then in a script handle the server message, otherwise only your player will see the message
as for making a message in the chat, you can look into this article
Is it possible to turn this into a function where whenever I need to send a server message in a server script, I can use the function in server script to call the local script to send a chat message?
What exactly do you mean by changing the event? Currently the remote event is fired on the server and received by the local script, which displays whatever message I place in between :DisplaySystemMessage("Message There!").
I would have to change it to :DisplaySystemMessage(text) in LocalScript and have the text as an argument for a function in ServerScript?
I want to make it so I can send the text message via a function from a server script. Currently this will only send whatever message I set in the LocalScript.
Ah…I thought it was more complicated than that. Did one previously for GUIs and it was definitely tedious. Will give this a try and let you know if there are any problems. Thanks