The ServerLog Returns anything a player says as Instance, and only updates the Chat GUI Once. I also have a RemoteEvent in ReplicatedStorage called CombadgeEvent, ServerScriptService is a script, Chat GUI is a localScript
ServerScriptService Script.
game.ReplicatedStorage.CombadgeEvent.OnServerEvent:connect(function(sender, msg)
local filteredmessage = game.Chat:FilterStringForBroadcast(msg, sender)
print(sender.Name..' Said: '..filteredmessage)
game.ReplicatedStorage.CombadgeEvent:FireAllClients(sender, filteredmessage)
end)
Chat GUI Script
local channels = script.Parent.Channels
local data = workspace.CombadgeSystem
local channel = script.Parent.Frequency
local on = script.Parent.On
local player = game.Players.LocalPlayer
local MACO = 1045203
local Temporal = 983872
local Starfleet = 947351
function transmit(sender, message)
data[channel.Value].Line1.Value = data[channel.Value].Line2.Value
data[channel.Value].Line2.Value = data[channel.Value].Line3.Value
data[channel.Value].Line3.Value = data[channel.Value].Line4.Value
data[channel.Value].Line4.Value = data[channel.Value].Line5.Value
data[channel.Value].Line5.Value = data[channel.Value].Line6.Value
data[channel.Value].Line6.Value = data[channel.Value].Line7.Value
data[channel.Value].Line7.Value = " "..script.Parent.Parent.Parent.Name..":"..message
end
function update(channel)
script.Parent.Alert:Play()
channels[channel].Line1.Text = data[channel].Line1.Value
channels[channel].Line2.Text = data[channel].Line2.Value
channels[channel].Line3.Text = data[channel].Line3.Value
channels[channel].Line4.Text = data[channel].Line4.Value
channels[channel].Line5.Text = data[channel].Line5.Value
channels[channel].Line6.Text = data[channel].Line6.Value
channels[channel].Line7.Text = data[channel].Line7.Value
end
game.ReplicatedStorage.CombadgeEvent.OnClientEvent:connect(transmit)
function power(message)
if string.find(message,"!on") == nil then
script.Parent.EquipSound:Play()
on.Value = false
channels.MACO.Title.Power.BackgroundColor3 = Color3.new(1,0,0)
channels.Starfleet.Title.Power.BackgroundColor3 = Color3.new(1,0,0)
channels.Temporal.Title.Power.BackgroundColor3 = Color3.new(1,0,0)
else
on.Value = true
channels.MACO.Title.Power.BackgroundColor3 = Color3.new(0,1,0)
channels.Starfleet.Title.Power.BackgroundColor3 = Color3.new(0,1,0)
channels.Temporal.Title.Power.BackgroundColor3 = Color3.new(0,1,0)
end
end
function toggle(message)
if string.find(message, "maco") ~= nil and player:IsInGroup(MACO) then
channel.Value = "MACO"
channels.Temporal.Visible = false
channels.MACO.Visible = true
channels.Starfleet.Visible = false
elseif string.find(message, "starfleet") ~= nil then
channel.Value = "Starfleet"
channels.Temporal.Visible = false
channels.MACO.Visible = false
channels.Starfleet.Visible = true
elseif string.find(message, "temporal") ~= nil and player:IsInGroup(Temporal) then
channel.Value = "Temporal"
channels.Temporal.Visible = true
channels.MACO.Visible = false
channels.Starfleet.Visible = false
end
end
script.Parent.Parent.Parent.Chatted:connect(function(message)
local MESSAGE = string.lower(message)
if on.Value == true and string.find(MESSAGE, "!on") == nil and string.find(MESSAGE, "!off") == nil and string.find(MESSAGE, "!channel") == nil then
game.ReplicatedStorage.CombadgeEvent:FireServer(player, message)
elseif string.find(MESSAGE, "!on") ~= nil or string.find(MESSAGE, "!off") ~= nil then
power(MESSAGE)
elseif string.find(MESSAGE, "!channel") ~= nil then
toggle(MESSAGE)
end
end)
data.Starfleet.Line7.Changed:connect(function() update("Starfleet") end)
data.MACO.Line7.Changed:connect(function() update("MACO") end)
data.Temporal.Line7.Changed:connect(function() update("Temporal") end)
channels.MACO.Title.Power.MouseButton1Click:connect(function() if on.Value == false then power("!on") else power("!off") end end)
channels.Starfleet.Title.Power.MouseButton1Click:connect(function() if on.Value == false then power("!on") else power("!off") end end)
channels.Temporal.Title.Power.MouseButton1Click:connect(function() if on.Value == false then power("!on") else power("!off") end end)
channels.StarfleetToggle.MouseButton1Click:connect(function() toggle("starfleet") end)
channels.MACOToggle.MouseButton1Click:connect(function() toggle("maco") end)
channels.TemporalToggle.MouseButton1Click:connect(function() toggle("temporal") end)
