Player Joined/Left Message

TextChatService instead of LegacyChatService.

by VoltenNa

Author Avatar

Since YouTube tutorials about this topic are outdated (using LegacyChatService), I decided to make an updated tutorial (using TextChatService).

The steps in this tutorials are based from the outdated YT ones but modified for TextChatService.

If you don't know why these steps are carried out, please watch Roblox Studio tutorials on YouTube or look up on the Developer Forum.


  1. First, we need to detect when Player joins or leaves.

Add a script in ServerScriptService and write the following (it's simple to understand so I won't have to explain)

game:GetService("Players").PlayerAdded:Connect(function(Player)
	print(Player.Name, "has joined.") --> Or Player.DisplayName :)
end)

game:GetService("Players").PlayerRemoving:Connect(function(Player)
	print(Player.Name, "has left.") --> Or Player.DisplayName :)
end)

-- You can Test play and check the Output.
  1. Since we have PlayerAdded detection script, we can use a RemoteEvent to send data from Server (the script we added in ServerScriptService) to Client (where the Chat Message will be displayed).
  1. Update our ServerScriptService script:
local PlayerEvents = game:GetService("ReplicatedStorage"):FindFirstChild("PlayerEvents")

game:GetService("Players").PlayerAdded:Connect(function(Player)
	PlayerEvents:FindFirstChild("Joining"):FireAllClients(Player)
end)

ggame:GetService("Players").PlayerRemoving:Connect(function(Player)
	PlayerEvents:FindFirstChild("Leaving"):FireAllClients(Player)
end)

-- FireAllClients for displaying Chat Message to everyone.
  1. Displaying Chat Message:
local PlayerEvents = game:GetService("ReplicatedStorage"):FindFirstChild("PlayerEvents")

PlayerEvents:FindFirstChild("Joining").OnClientEvent:Connect(function(Player)
	game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(`<font color='#ffffff'>{Player.Name.. " has joined."}</font>`)
end)

PlayerEvents:FindFirstChild("Leaving").OnClientEvent:Connect(function(Player)	
	game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(`<font color='#ffffff'>{Player.Name.. " has left."}</font>`)
end)
 --> Or Player.DisplayName :)
  1. More: And that's it. It's done. Go play a game on Client (not Studio) and it should work as intended.

View in-game to comment, award, and more!