Hello, I have recently added a Radio GUI system for Emergency Responder teams in my game. Now, this is cool, however, people are able to type whatever they feel into the radio! I need a way to filter the text they send through the UI. With regards to the picture below, can anyone help with the script and where to put it?
GUI Layout:
Try this:
local TextService = game:GetService("TextService")
function ReceivedMessage (Plr, Msg, Destination)
if Msg ~= "" then
local FilteredMsg = FilterMessage(Plr, Msg)
if FilteredMsg ~= nil then
-- Send the filtered message to your destionation
end
end
end
function FilterMessage(Plr, Message)
local UserID = Plr.UserId
local FilteredResult = ""
--Filter based on a users personal settings
local Final, Error = pcall(function()
FilteredResult = TextService:FilterStringAsync(Message, UserID)
FilteredResult = FilteredResult:GetChatForUserAsync(UserID)
end)
if Final then
return FilteredResult
else
warn("Problem with text")
return nil
end
end
I havn’t tested it yet so It might not work as planned. Just put in your ServerRadioScript and it should hopefully work.