How can i filter a textbox

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    wanted to filter a textbox
  2. What is the issue? Include screenshots / videos if possible!
    trying to filter the textbox
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    nope
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    ok
-- how can i make a filter for textbox
--ofc i cant code

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
ok
i just want to filter a textbox
ofc im not showing a video if it works or not

2 Likes

Take a look at this doc. That should provide the answer!

1 Like

let me see if it works 1 second

1 Like

wait how do i use these :skull: :sad: i dont know

1 Like

@6Square4 gave you a doc providing information on how to filter, what are you confused by?

1 Like
textbox.Changed:Connect(function()
textbox.Text = TextService:FilterStringAsync(textbox.Text, game.Players.LocalPlayer.UserId);
end)

-- Try that! Note: I never used this function so it could be incorrect
-- on the way I handled it.
1 Like

ok let me test that out lol :skateboard: i did not expect to this thingy be so easy

1 Like

If that doesn’t work, just detect when the textbox is no longer focused and then update it (as that function would update it as they type.)

1 Like

is it a game:GetService(“TextService”)? its giving me error of something let me see

1 Like

If that doesn’t work, I think I have a solution that doesn’t need FilterStringAsync:

if text.Text ~= string.sub(0, #string) then
    repeat wait(0.1) until text.Text ~= " "
end
-- make sure text variable is the text box that you want players to type in
1 Like

its says that it needed to be called from server script
yes dfn150

1 Like

Could you please try my script?

1 Like

Try dfn150’s script - if it still doesn’t work, fire the server to return the filtered string.

1 Like

its a death screen you can customize it i just wanted filter to prevent putting bad words and deleting my account
by the way its need to be roblox filter bc its good :skull: :sad:

1 Like

If you want it to filter the Roblox chat system, then that is not possible

1 Like

Try something like this then if his doesn’t work:

local Message = " ";
local Textbox = script.Parent;
local Filter = remotes.Filter;
Textbox.FocusLost:Connect(function()
local newMessage = Filter:InvokeServer(Textbox.Text);
Message = newMessage;
Textbox.Text = Message;
end)

On the server:

function remote.OnServerInvoke(player, String)
return TextService:FilterStringAsync(String, player.UserId);
end
1 Like

oh then it gotta be atleast a good filter to filter a textbox

1 Like

i want to say which remote is it is it a binthingy function
nevermind

1 Like

Remote Function to return data back to the client.

1 Like
local banned_words = {
"bad word",
"something else",
"etc"
}

TextBox.Changed:Connect(function()
    if TextBox.Text == [1, #banned_words] then --if this line errors than put parentheses over 1 and banned words
        TextBox.Text = "Will not load text" --or something else
    end
end)
2 Likes