RemoteEvents not working as intended


So I am making a filtering system for when a player types in a box. For some reason, the server isn’t getting the text, however getting the Instance.


	local plr = game.Players.LocalPlayer
	script.Parent.GetName:FireServer(plr, script.Parent.Text)


script.Parent.GetName.OnServerEvent:Connect(function(plr, newName)
	local ts = game:GetService("TextService")
	local filteredText = ts:FilterStringAsync(newName, plr.UserId)

You don’t need to fire server with the player argument since function itself does that for you and also that sets 2nd parameter of the function connected to OnServerEvent to the player you sent as the first argument, not the text you passed as the 2nd argument.

So just change :FireServer(plr, script.Parent.Text) to :FireServer(script.Parent.Text).


Don’t fire the server with the client, only send what you wanna send. On the server event section just do: per,newName. It’ll automaticly send the player FIRST. So don’t send it yourself.

I am using plr to get the UserId from them

Yes, I understand that. But if you send the player in a remote event It breaks the script, you only want to send information. When you “capture” the remote event on the server side just put: plr before any information. It’ll automaticly send it and make it the first thing you can call.

The script isn’t broken. I am trying to everything I can to make it print the filtered text and not “Instance”. It still prints, therefore it isn’t working… just not printing as intended.

As everyone else says, just remove the plr argument in :FireServer() and it will work fine.

Yes, it’s working as intended. TextService’s filterstringasync returns an instance, and you forgot one more step which is below (to get the text).

The fix is this, the one you wanna print is this.

local textresult = filteredText:GetNonChatStringForBroadcastAsync()

This won’t work because the server will not receive anything.

EDIT: Misread it, yes, you should remove the plr arg on the client.

It will, player is automatically passed as first argument when doing :FireServer. RemoteEvent:FireServer

1 Like

I already changed it but i is still getting the Instance and the Instance only

As has been said several times, your confusion seems to stem from misunderstanding how FireServer arguments are received. The client who fired the remote is automatically the first argument given to the server followed by whatever you define. Simply removing the player from your LocalScript will fix it.

On another note though: both the RemoteEvent and the script responsible for handling OnServerEvent should not be children of your TextBox. Canonically you should be putting your remotes in ReplicatedStorage and your scripts in ServerScriptService. Guis should only contain LocalScripts and ModuleScripts (the latter of which is intended to run in a client-side environment after being required by a LocalScript). Would advise rethinking your structure in addition to fixing the initial issue.


No. It doesn’t fix at all. To my knowledge it doesn’t matter if you have plr there. My other script will recognize it as plr. I don’t have to remove it.

Why put something that is not needed at all?

Yes it does matter if you have the player there, because now you’re slotting those arguments further away. A RemoteEvent will always receive n+1 arguments. The server will always receive the firing client as the first and the other arguments are pushed down.

If you send the player and the text, your server will receive three arguments: the player twice and the message. You’re only accounting for two arguments, so your third one is dropped. Please read the documentation, it does fix it.


Look above, brother. I have since REMOVED it…

To my knowledge it doesn’t matter if you have plr there. My other script will recognize it as plr. I don’t have to remove it.

I was referring to this part of your reply.

1 Like