This script is supposed to send a chat message with a prefix. It only works in a Studio Test server and not in a Game Server. Also, is there anyway to cancel the original chat message the player sent so it only sends the message by the RemoteEvent?

Yes, there is a LocalScript in the RemoteEvent that is being fired and it works with a different script.

local group = {
	["Player1"] = true;
	["TheEpicCooldeal"] = true;
}
 
game.Players.PlayerAdded:connect(function(player)
	if group[player.Name] then 
		player.Chatted:connect(function(msg)
			local message = Instance.new('StringValue', player)
			message.Name = 'NewChatMessage'
			message.Value = msg
			game.ReplicatedStorage.AdminChat:FireAllClients('[OWNER]: '..player.Name..': '..message.Value)
			wait(1)
			message:Destroy()
		end)
	end
end)

4 comments

0

Are there any errors in the console when you play test?

0

No.

0

There is no need to create a StringValue firstly and can you include some prints to find out what is being ran.

0

Okay, is there a way to stop the original message from being sent?