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

Print PlayerAdded:connect in chat?

Asked by 8 years ago

How can I make this script say something like:

PvPNinjaDragon has joined the game!

I have a script that I believe that does this except it prints it in the Output. How can I make it so that it says it in the game chat?

01local Players = game:GetService("Players")
02 
03function onPlayerAdded(player)
04    print(player.Name .. " has entered the game")
05end
06 
07Players.PlayerAdded:connect(onPlayerAdded)
08 
09for _,player in pairs(Players::GetPlayers()) do
10    onPlayerAdded(player)
11end

Please help me, thank you.

0
It's not possible to do this with Roblox's normal chat system. You can either use a Gui or custom chat system. Mayk728 855 — 8y
0
Yes, it is possible. One second. awfulszn 394 — 8y

1 answer

Log in to vote
0
Answered by
awfulszn 394 Moderation Voter
8 years ago
Edited 8 years ago
1game.Players.PlayerAdded:Connect(function(player)

The PlayerAdded event just connects to the function whenever a player joines.

1game.StarterGui:SetCore("ChatMakeSystemMessage", {

This just creates a SystemMessage in the chat.

1    Text = player.Name.." has entered the game!";
2    Color = Color3.new(0, 1, 1);
3    Font = Enum.Font.SourceSansBold;
4    FontSize = Enum.FontSize.Size24
5})
6end)

These are just some variables you can customise.

Full code:

01game.Players.PlayerAdded:Connect(function(player)
02 
03game.StarterGui:SetCore("ChatMakeSystemMessage", {
04    Text = player.Name.." has entered the game!";
05    Color = Color3.new(0, 1, 1);
06    Font = Enum.Font.SourceSansBold;
07    FontSize = Enum.FontSize.Size24
08})
09 
10end)

Remember to accept my answer if it helped and to leave a comment if you need further assistance, and to refer to this!

0
Doesn't seem to work when I actually play the game. But I does work when I test it in studio in play mode. PvPNinjaDragon 35 — 8y
Ad

Answer this question