Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Chatted property does not work properly. Why?

Asked by 7 years ago

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)
0
Are there any errors in the console when you play test? RubenKan 3615 — 7y
0
No. TheEpicCooldeal 12 — 7y
0
There is no need to create a StringValue firstly and can you include some prints to find out what is being ran. User#5423 17 — 7y
0
Okay, is there a way to stop the original message from being sent? TheEpicCooldeal 12 — 7y

Answer this question