Text output Filter, Username auto completion, Output duplicated

  1. What do you want to achieve? Keep it simple and clear!

1.1. Text output filter
So I added a GUI where players can check in other users. To prevent abuse of that tool, I want to add a text output filter before it gets displayed on a monitor.

1.2. Username auto completion
I want also, that players only can insert a username that is currently online on the same server or at least a name auto completion.

1.3. Duplicated output
So I “save” the input of the players in a RemoteEvent. If a player sends the text it gets displayed on a display. The problem with that is, that the values that has been applied before, are getting outputted again.

  1. What is the issue? Include screenshots / videos if possible!

I got no experience with the ChatFilter System so far and I quit don’t understand it completely.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Regarding to 1.1.

local RemoteEvent = game:GetService("ReplicatedStorage").CheckInReason

RemoteEvent.OnServerEvent:Connect(function(player, text)
local TextService = game:GetService("Chat")

local FilteredreasonText = TextService:FilterStringForBroadcast(text, player)
local reasonText = FilteredreasonText

--- USERNAME ----

local RemoteEvent2 = game:GetService("ReplicatedStorage").CheckInUsername

RemoteEvent2.OnServerEvent:Connect(function(player, text)
local usernameText = text

Regarding to 1.3.
Screenshot 2020-05-08 at 18.34.34

Thank y’all already and sorry for such a long Scripting Support request, but I guess its better like this than creating a new thread for every problem.

A lot of filtering requires the use of pcall, due to the extensive use of TextService. The player inputs something to server. The server will use something similar to the example then change the GUI. However, you’re a little unclear on what GUI it is. If it’s PlayerGui, fire the remote with the filtered text to the correct player for display.

The auto-completion is using something called a “fuzzy search”. By producing a table with player names by obtaining the players online on the server, using the fuzzy search function allows you to match the input with the probable username.

For duplicated output, something is firing to the output twice by connecting to the event twice or something. Unfortunately, I cannot identify the issue without any code I can review on.


For more information:

2 Likes

I guess I have to look into the Text and Chat Filtering system a little bit more. I was reading it like 10 times but I still don’t get the concept behind it. It’s made too complicated in my opinion but anyways.

I will look into fuzzy search, thank you very much.

All I can say to the duplicated output is, that the RemoteEvent “CheckInReason” and “CheckInUsername” are both fired once per click on submit and as you can see on the first screenshot its not just fired twice, it’s like it’s saving the value and uses all values ever entered after every new input. The script for this looks like that:

local RemoteEvent = game:GetService("ReplicatedStorage").CheckInReason
local TextBox = script.Parent

script.parent.parent.submit.MouseButton1Down:Connect(function()
    RemoteEvent:FireServer(TextBox.Text)
end)

and

local RemoteEvent = game:GetService("ReplicatedStorage").CheckInUsername
local TextBox = script.Parent

script.parent.parent.submit.MouseButton1Down:Connect(function()
    RemoteEvent:FireServer(TextBox.Text)
end)

Both are located separate in their own TextBoxes. Screenshot 2020-05-08 at 20.36.47

Upon reviewing the 1.3, how do the server scripts work with the input from the players? I’m still puzzled because the 1.1 is only an attempt to use the TextService(although the script clearly uses Chat).

The output of the input is like that:

-- Displays on monitor
local tl = Instance.new("TextLabel")
	tl.Text = usernameText .. ": " .. reasonText
	tl.Parent = script.Parent
	tl.Name = usernameText
	tl.Size = UDim2.new(0, 350, 0, 30)
	tl.Parent = uiGridLayout.Parent
	tl.TextScaled = true
	tl.BackgroundTransparency = 1
	tl.TextXAlignment = 0
	tl.TextColor3 = Color3.new(255, 255, 255)

Into a UiListLayout

And I may found the wrong thing I did and why it’s showing all entries.

I’m still puzzled. Check the following:

  • Duplicate connections
  • Duplicate scripts elsewhere

May it be like that because I use a UiListLayout?

Not possible, no object can create itself twice without a script.

I don’t see any other problem. I even renamed the RemoteEvent and only changed the used script to the new RemoteEvent name. Nothing changed.

Try this: Add something to signal each output at the server after remote event is fired. I think there’s something about the client firing twice than once or if the server is outputting it twice.

There you go.
Screenshot 2020-05-08 at 21.06.42

He is giving a new output of the new value but also gives a output of the old value but only the reason output.

To explain what I did:

1st time fired:
Username: Username1
Reason: Reason1

Output:
Username1
Reason1

2nd time fired:
Username: Username2
Reason: Reason2

Output:
Username2
Reason2
Username2
Reason1

3rd time fired:
Username: Username3
Reason: Reason3

Output:
Username3
Reason3
Username3
Reason2
Username3
Reason1

I solved everything. Still thank you @Operatik for your help. The solution was a wrong placed “end” in the script. :roll_eyes:

1 Like