Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i add Filtering to this Chat GUI?

ROBLOX Just took down a bunch of my groups places becouse our Coms GUI does not comply with the new filtering, how would i add it to this script?

Edit I can now see my messages being posted, but no one elses

local channels = script.Parent.Channels
local data = workspace.OfficerRadioSystem
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(msg, sender)
	local  filteredmessage = game.Chat:FilterStringForBroadcast(msg, sender)
	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..":"..filteredmessage
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
function power(msg)
	if string.find(msg,"!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(msg)
	if string.find(msg, "maco") ~= nil and player:IsInGroup(MACO) then
	channel.Value = "MACO"
	channels.Temporal.Visible = false
	channels.MACO.Visible = true
	channels.Starfleet.Visible = false      
end
if string.find(msg, "starfleet") ~= nil then
	channel.Value = "Starfleet" 
	channels.Temporal.Visible = false
	channels.MACO.Visible = false
	channels.Starfleet.Visible = true   
end
if string.find(msg, "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(msg)
	local MSG = string.lower(msg)
if on.Value == true and string.find(MSG, "!on") == nil and string.find(MSG, "!off") == nil and string.find(MSG, "!channel") == nil 	then
	transmit(msg, script.Parent.Parent.Parent)
	elseif string.find(MSG, "!on") ~= nil or string.find(MSG, "!off") ~= nil then
	power(MSG)
	elseif string.find(MSG, "!channel") ~= nil then
	toggle(MSG)         
	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)

1 answer

local channels = script.Parent.Channels
local data = workspace.OfficerRadioSystem
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(msg, sender)
local  filteredmessage = game.Chat:FilterBessageForBroadcast(msg, sender)
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..":"..filteredmessage
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
function power(msg)
if string.find(msg,"!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(msg)
if string.find(msg, "maco") ~= nil and player:IsInGroup(MACO) then
channel.Value = "MACO"
channels.Temporal.Visible = false
channels.MACO.Visible = true
channels.Starfleet.Visible = false      
end
if string.find(msg, "starfleet") ~= nil then
channel.Value = "Starfleet" 
channels.Temporal.Visible = false
channels.MACO.Visible = false
channels.Starfleet.Visible = true   
end
if string.find(msg, "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(msg)
local MSG = string.lower(msg)
if on.Value == true and string.find(MSG, "!on") == nil and string.find(MSG, "!off") == nil and string.find(MSG, "!channel") == nil then
transmit(msg, script.Parent.Parent.Parent)
elseif string.find(MSG, "!on") ~= nil or string.find(MSG, "!off") ~= nil then
power(MSG)
elseif string.find(MSG, "!channel") ~= nil then
toggle(MSG)         
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)

1 comment

0

FilterMessageForBroadcast is not a valid member of chat, that pops up in the server log

This discussion is preserved as it was. New answers, comments, and votes are closed.