Filtering Text Help

Hey, I’ve recently started a project to make something like an “Announcement Panel” and what I am having trouble with is filtering the text that is fired through a remote event.

– Local Script

PromptMessage.Submit.Activated:Connect(function()
	local Message = PromptMessage.MessageBox.Text
	local playerName = LocalPlayer.Name
	

	if MarketplaceService:UserOwnsGamePassAsync(LocalPlayer.UserId, 1)  then
		game.ReplicatedStorage.AnnouncementMessage:FireServer(Message)
	end
end)

– Server Script

game.ReplicatedStorage.AnnouncementMessage.OnServerEvent:Connect(function(Message)

local filteredText = game:GetService("Chat"):FilterStringForBroadcast(Message)

print(filteredText)

end)

The Error

Argument 2 missing or nil
Line 70 ( which is local filteredText = game:GetService(“Chat”):FilterStringForBroadcast(Message)

Message right now is technically the player that fired the remote event, since the first argument passed is the player who fired. FilterStringForBroadcast takes 2 arguments, the message and the player. Change the server code to this:

game.ReplicatedStorage.AnnouncementMessage.OnServerEvent:Connect(function(Player, Message)

local filteredText = game:GetService("Chat"):FilterStringForBroadcast(Message, Player)

print(filteredText)

end)

Working perfectly, thanks for your help.