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.
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!