Hello! My game has recently been closed for moderation as we have a naming GUI without a filter, I've been trying to get FilterStringAsync to work but I can only get it working for a custom chat and not for typing names into a gui for a billboardgui. This is the GUI script;
local Detect = script.Parent.FocusLost Detect:connect(function() local player1 = game.Players.LocalPlayer if script.Parent.Text ~= "" then player1.leaderstats.Character.Value = script.Parent.Parent.PlayerName.Text player1.Character.Head.BillboardGui.MainFrame.PlayerLabel.Text =(script.Parent.Text) player1.Character.Head.BillboardGui.MainFrame.PlayerName.Text = player1.Name end end)
I've tried using the FilterStringAsync unsuccessfully and need help. I'm struggling and would just like my game back, thankyou
Before I answer your question, read up on this ROBLOX wiki post.
What Is FilterStringAsync?
According to the ROBLOX Wiki, FilterStringAsync
is a built-in function that:
Filters a string being sent to playerTo from playerFrom with filtering that is appropriate to the given player's account settings. This function should be used any time a user can enter custom text in any context.
Based upon this information, FilterStringAsync is a function that allows us to filter strings just as they would be in the default ROBLOX chat. This can be used to hashtag words that ROBLOX wouldn't normally allow.
How do we use it?
FilterStringAsync takes 3 arguments: string stringToFilter
Player playerFrom
and Player playerto
(These arguments are pretty self-explanatory, so I won't waste time explaining them).
Based on this information, we can use the function like so:
local PlayerYouWantToSendThisTo = game:GetService("Players"):FindFirstChild("Player2") game:GetService("Chat"):FilterStringAsync("THIS IS THE STRING TO FILTERING NARB", game:GetService("Players").LocalPlayer, PlayerYouWantToSendThisTo)
To Conclude, if you have anymore questions, feel free to ask in the form of a comment, or even a totally different question.