My server join message script has mysteriously stopped working

The purpose of this script is to pick a random message whenever a player joins the game (There is another script in server script service that fires an event. From my testing, this seems to be working fine) , and pairs it with the username of said player, before broadcasting it in the chat. This no longer works out of the blue, due to the phasing out of the legacy chat system.

I’m pretty much a beginner when it comes to scripting, and don’t do it very often. I don’t know how I would go about fixing this. Any help/insight would be greatly appreciated if possible.

Attached is the original script.

Thank you!

local messages = {" has joined the game!", " has arrived!", " is here!", " joined the game!", " joined the server!", " has joined!"}

game.ReplicatedStorage.PlayerJoinedRE.OnClientEvent:Connect(function(plrName)

	local function chat(message)
		game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("formateddeathmessage",{
			Text = message;
			Color = Color3.fromRGB(78, 255, 134);
			Font = Enum.Font.FredokaOne;
		})
	end

	chat(plrName .. messages[math.random(1,#messages)])

end)

You can just use HTML tags instead.

game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage("<font color = 'rgb(78, 255, 134)' face = 'FredokaOne'>"..message.."</font>")
2 Likes

Edit: It works! Thank you so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.