How to send welcome message on player join

I’m wanting to add a welcome message to players who join the game using the new TextChatService.

local SystemChannel = TextChatService:FindFirstChild("RBXSystem", true)

SystemChannel:DisplaySystemMessage(string.format("Welcome %s to Game!", Player.DisplayName))

However when I play test, it doesn’t show up in chat??

I’m not 100% sure on this but maybe try setting ChatVersion in TextChatService to TextChatService
image

Try:

local TextChatService = game:GetService("TextChatService")
local SystemChannel = TextChatService:FindFirstChild("RBXSystem", true) 

game.Players.PlayerAdded:Connect(function(Player)
    SystemChannel:SendAsync(string.format("Welcome %s to the game!", Player.DisplayName))
end)

This code waits for a player to join the game, then finds the RBXSystem channel using the TextChatService and sends a welcome message to that channel using the player’s display name. Note that this code assumes that the TextChatService is enabled for the game and that the RBXSystem channel exists. You may need to adjust it based on your specific use case.

2 Likes

this should be solution

You said it first lol

1 Like

After running some tests, I found my last code didn’t work.
But this works, the following code should be a LocalScript, put it under either ReplicatedFirst or StarterPlayerScripts:

local TextChatService = game:GetService("TextChatService")

task.wait(3) -- wait for everything to be loaded

local SystemChannel = TextChatService:FindFirstChild("RBXSystem", true)
if not SystemChannel then
	local TextChannels = TextChatService:WaitForChild("TextChannels")
	local newChannel = Instance.new("TextChannel")
	
	newChannel.Name = "RBXSystem"
	newChannel.Parent = TextChannels
	SystemChannel = newChannel
end

SystemChannel:DisplaySystemMessage(string.format("Welcome %s to Game!", game.Players.LocalPlayer.DisplayName))

This code creates or finds an existing TextChannel called “RBXSystem” using the TextChatService in a Roblox game. If the channel doesn’t exist, it creates a new one and sets it as the SystemChannel. Finally, it displays a system message in the SystemChannel welcoming the local player to the game, using their display name. The script waits for 3 seconds before executing to ensure that everything is loaded properly.

9 Likes