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 7 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?

local Players = game:GetService("Players")

function onPlayerAdded(player)
    print(player.Name .. " has entered the game")
end

Players.PlayerAdded:connect(onPlayerAdded)

for _,player in pairs(Players::GetPlayers()) do
    onPlayerAdded(player)
end

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 — 7y
0
Yes, it is possible. One second. awfulszn 394 — 7y

1 answer

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

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

game.StarterGui:SetCore("ChatMakeSystemMessage", {

This just creates a SystemMessage in the chat.

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

These are just some variables you can customise.

Full code:

game.Players.PlayerAdded:Connect(function(player)

game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = player.Name.." has entered the game!";
    Color = Color3.new(0, 1, 1);
    Font = Enum.Font.SourceSansBold;
    FontSize = Enum.FontSize.Size24
})

end)

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 — 7y
Ad

Answer this question