Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to have a script say something inside chat?

Asked by
yelsew 205 Moderation Voter
8 years ago

I'm wondering how to make a script say something in chat. Simply what function lets you do this? I know print() types to the console, but what would say something in player chat?

0
If this isn't clear, then let me set an example. In most GMod or Minecraft servers, when a player joins, it will post a comment in chat saying "(name) has joined the server." yelsew 205 — 8y

1 answer

Log in to vote
1
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

Yes, you can have the script say something in chat using ChatMakeSystemMessage. Example straight from the wiki:

game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
    Text = "Welcome to my game!"; -- Required. Has to be a string!
    Color = Color3.new(0,1,1); -- Cyan is (0,255/255,255/255) -- Optional defaults to white: Color3.new(255/255, 255/255, 243/255)
    Font = Enum.Font.SourceSans; -- Optional, defaults to Enum.Font.SourceSansBold
    FontSize = Enum.FontSize.Size24; -- Optional, defaults to Enum.FontSize.Size18
})

This would have to be in a local script. I just performed some tests on it, as well, and you CAN make multiple messages, triggered by what you choose:

game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
    Text = "Testing this out!";
    Color = Color3.new(0,1,1);
    Font = Enum.Font.SourceSans;
    FontSize = Enum.FontSize.Size24; 
})


wait(10)


game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
    Text = "Let's see if I can do it twice!";
    Color = Color3.new(0,1,1); 
    Font = Enum.Font.SourceSans;
    FontSize = Enum.FontSize.Size24;
})

This script produced this result. Here's a link to the wiki, as well.

Ad

Answer this question