Filtered message is returned as "Instance"?

Hello! I am trying to make a custom radio but when it comes to filtering the message, it goes through the server and comes back as “Instance” when I didn’t type that! I am using the game chat.

So when the message comes back from the server from being filtered, a chat “template” is cloned and the message is placed into a text label. When I test it, the text label is the word “Instance” (video below).


Local script

local player = game.Players.LocalPlayer
local remote = game.ReplicatedStorage.SendTextToServer
local main = player.PlayerGui.Radio.Main

player.Chatted:Connect(function(message)
	remote:FireServer(player, message)
end)

game.ReplicatedStorage.SendTextToClient.OnClientEvent:Connect(function(filteredMessage)
	local UI = main.Template.ChatTemplate:Clone()
	UI.Unit.Text = "Unit "..main.UnitNumber.Value
	UI.Chat.Text = filteredMessage
	UI.Visible = true
	
	if main.CurrentChat.Value == "Police" then
		UI.Parent = main.PDCHAT
	elseif main.CurrentChat.Value == "Fire" then
		UI.Parent = main.FDCHAT
	elseif main.CurrentChat.Value == "DOT" then
		UI.Parent = main.DOTCHAT
	end
end)

Server script

game.ReplicatedStorage.SendTextToServer.OnServerEvent:Connect(function(player, message)
	local filteredMessage = game:GetService("Chat"):FilterStringForBroadcast(message, player)
	game.ReplicatedStorage.SendTextToClient:FireClient(player, filteredMessage)
end)

Can anybody help?

you do not need to send the player variable since the server already receives that, change this to

player.Chatted:Connect(function(message)
	remote:FireServer(message)
end)
1 Like