So I am currently working on a Lua console, and I wanted to filter the text label that is the output, (It’s global, mostly because it’s funny to talk to other people) but I couldn’t find a way to do this, I have made some basic scripts to do this, but they never worked.
local plr = game.Players.LocalPlayer
coroutine.wrap(function()
game.ReplicatedStorage.CurrentLine:GetPropertyChangedSignal("Value"):Connect(function()
local text = game.ReplicatedStorage.CurrentLine.Value
local message = script.Parent.Text
local filteredMessage = ""
script.Parent.Text = game.ReplicatedStorage.FilterOutputEvent:FireServer(message,filteredMessage)
end)
end)()
I have never did anything with filtering, so I have no idea about good practices, and how to actually filter text.
After a simple print function into the console, I get an error:
I recommend reading this DevHub article on chat filtering. I’m not an expert in chat filtering and custom chat boxes as I haven’t had a need for it yet, but it looks like you should wrapping your filtering function in a pcall.
Also, not sure why the text variable is needed in the local script because it doesn’t look like you’re doing anything with it.
Your error message means that your 3rd argument was nil, and that there was never a string.
I disabled use of HTTP requests in my game, and I made the game kick you if you try to use HttpService in the console, so I don’t really know why this is Happening.
Roblox’s filtering process is done internally which I’m pretty sure means Roblox has to use some filtering software of their own which is on another website. The article I linked mentioned that. Try allowing http requests. I’m not sure how anyone besides you would be able to send http requests through the dev console because it should be only available to you.
Okay something really weird happened, at first I just got the same error, but I tried to input another print command, and it showed the normal string, then the filtered string into the custom output with a slight delay, which I think I know where the issue lies at, but the error appearing when you type something in at first, is just unexpected.
EDIT: I tried to print “hi” in my custom console, and the output flashed between “hi” and this filtered error:
The filtered message appearing after the actual message is the error. The error points to line 11 which is: local filteredMessage = TextService:FilterStringAsync(message,plr.UserId).
I made an infinite loop. I tried to print the message that is being sent from the client, on the server, and it just prints the message, then a blank string, then the message again, again and again again, forever.
EDIT: I think I found the problem, in the server script, there is a section that changes a value called “CurrentLine” to the whatever appears in the output. In the section that filters the output, it changes the value of “CurrentLine” to the filtered text, that would be fine and all, but in the local script that actually shows the output to the player, it detects when the value of “CurrentLine” changes, and when it does, it fires a remote event to filter the text, which then changes the value of “CurrentLine”, which makes the local script fire the remote event again, and so on, and so forth.
The game is singleplayer only at the moment, mostly because of the unfiltered output, so it wouldn’t be that bad if left the output unfiltered. Thank you for your help!