How would I filter my radio's chat through the roblox chat system?

I have this radio/walkie talkie system in my game that I found in the toolbox and while testing I noticed that the bubble chats that appear are unfiltered, even when testing in game and in studio. I would also like to mention that I do not have a lot of scripting knowledge but I’m able to move around and understand most basic scripts to some degree.

Here is an example of the system in action

I’ve looked at other topics similar to my issue and they either aren’t applicable to my situation or I simply don’t comprehend them. I’ve had a look at this guide but with barely any scripting knowledge I can’t figure out how I would apply such services to my script;

LocalScript

local Chat = game:GetService("Chat")
local Players = game:GetService("Players")
local Radio = script.Parent:WaitForChild("Handle")
local Remote = script.Parent.RemoteEvent
Players.LocalPlayer.Chatted:Connect(function(msg)
	if Radio:IsDescendantOf(Players.LocalPlayer.Character) then
		Remote:FireServer(msg)
	end
end)

Script

local MS = game:GetService("MessagingService")
local Players = game:GetService("Players")
local Chat = game:GetService("Chat")
local MSG_TOPIC = "FunMurderRadio"
local Radio = script.Parent:WaitForChild("Handle")
local Remote = script.Parent.RemoteEvent
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://757303230"
Sound.RollOffMinDistance = 5
Sound.RollOffMaxDistance = 50
Sound.RollOffMode = Enum.RollOffMode.InverseTapered
Sound.PlayOnRemove = true
local SpeakPart = Instance.new("Part",Radio)
SpeakPart.Size = Vector3.new(0,0,0)
SpeakPart.CanCollide = false
SpeakPart.Transparency = 1
local SpeakWeld = Instance.new("WeldConstraint",SpeakPart)
SpeakWeld.Part0 = SpeakWeld.Parent
SpeakWeld.Part1 = Radio
local Root = script.Parent.Parent:FindFirstChild("HumanoidRootPart")
function onMessage(Data)
	Chat:Chat(SpeakPart,Data.Data)
end
local MessageConnection = MS:SubscribeAsync(MSG_TOPIC,onMessage)
Remote.OnServerEvent:Connect(function(Player,msg)
	MS:PublishAsync(MSG_TOPIC,msg)
end)
Chat.Chatted:Connect(function(Part)
	local AudioPart
	if Radio:IsDescendantOf(workspace) then
		AudioPart = Radio
	elseif Root then
		AudioPart = Root
	end
	if Part == SpeakPart then
		local Sound = Sound:Clone()
		Sound.Parent = AudioPart
		Sound:Destroy()
	end
end)
script.Parent.Equipped:Connect(function()
	SpeakPart.Position = Radio.Position
	SpeakPart.Parent = workspace
end)
script.Parent.Unequipped:Connect(function()
	if not script.Parent:IsDescendantOf(workspace) then
		SpeakPart.Position = SpeakPart.Position - Vector3.new(0,math.huge,0)
		SpeakPart.Parent = script.Parent
	end

end)
script.Parent.AncestryChanged:Connect(function()
	Root = script.Parent.Parent:FindFirstChild("HumanoidRootPart")
end)
2 Likes

F i l t e r S t r i n g F o r B r o a d c a s t

2 Likes
  • There is a Chat.Chatted event that can be fired with parameters to display a dialog-like billboard above a part or character when the event is triggered.
  • The Chat service has a method InvokeChatCallback to call functions registered by RegisterChatCallback based on different events in the chat system.
  • The article explains the different callback types that can be registered using RegisterChatCallback, such as OnCreatingChatWindow, OnClientFormattingMessage, and OnServerReceivingMessage, each with its specific purpose.
  • The SetBubbleChatSettings function customizes various settings of the in-game bubble chat in a client-side context.
  • The article warns that calling the FilterStringAsync function from the client using a LocalScript is deprecated, and filtering should be done from the server-side using TextService:FilterStringAsync().
  • The FilterStringForBroadcast function filters a string sent from one player to be broadcasted to no particular target.
1 Like

Text Filtering | Documentation - Roblox Creator Hub

3 Likes