So basically I am making a text box that when you enter something in the text box it'll copy the text entered into the text box into a text label. But I've heard that you need to use ROBLOX's function FilterStringAsync in order to filter your texts so your game doesn't get taken down. I've looked at many tutorials, none are helping. Here is my script:
local plr = game.Players.LocalPlayer while true do script.Parent.Text = plr.PlayerGui.IntroP2.introp2fr.ChannelBox.Text:FilterStringForBroadcast() end
string
. Neither can you filter on the client, as the client can disagree to filter the text, thus any malicious text being broadcasted (such as not filtering the name of a pet). You could return some filtered text from the server and have the client get that text, with a RemoteFunction
.-- Script, in ServerScriptService wait() local ChatService = game:GetService("Chat") local ReplicatedStorage = game:GetService("ReplicatedStorage") local FilterText = ReplicatedStorage:WaitForChild("FilterText") FilterText.OnServerInvoke = function(player, text) return ChatService:FilterStringForBroadcast(text, player) -- player is the string that the player is from, text is the text to filter end
wait() local Players = game:GetService("Players") local Player = Players.LocalPlayer local PlayerGui = Player:WaitForChild("PlayerGui") local text = script.Parent local ChannelBox = PlayerGui.IntroP2.intop2fr.ChannelBox local ReplicatedStorage = game:GetService("ReplicatedStorage") local FilterText = ReplicatedStorage:WaitForChild("FilterText") -- listen for the text to change ChannelBox:GetPropertyChangedSignal("Text"):Connect(function() text.Text = FilterText:InvokeServer(ChannelBox.Text) -- the text returned by the server -- sets text to what the server filtered end)