Trouble with sending text via FireClient()

Straight to the point: I’m making a script for one of my games, you’re supposed to type in something in a certain textbox, then press a button and it should send what you typed in to whatever is linked to the remoteEvent called “door”. The problem is, just as I said about a year ago, I’m a bad scripter, if I am one, even, so it obviously doesn’t work. The error that pops up is:
"Unable to cast value to Object - Server - Script:28"

here’s the thing you need, I guess. the script it sends info to is nothing important, it’s a temporary print script.

    -- rest of code here

    event:FireClient(Player, text)
1 Like

Are you sure you’re using the right function? Contrary to their names, FireClient is meant to be called from the server to the client, and FireServer should be called from the client to the server.

From the description you wrote, I assume that’s what you meant to use.

He fixed it by adding the player you want to fire the remote to, that’s what was missing.

Yes, I see that. But I am inclined to believe that the script was a LocalScript, as:

  1. OP mentioned sending text from the client to the server (then to others)
  2. They use GUI objects which are not usable in Server scripts.

Oopsie, it is a server script


The textbox text would be blank on the server.


I should try using FireServer, one moment… It says “FireServer can only be called from the client”.
I dunno, the thing you wrote seemed pretty logical to me. Also, wanted to add: the event is located in the workspace, and so is the script, if it’s any helpful.

1 Like

Yeah, my bad, I didn’t notice that :sweat_smile:.

But there still remains the issue that GUIs are inaccessible by Server scripts and another RemoteEvent must be used to send the text in the frame/TextBox from the client to the server, then to other clients.


Where do I place it, somewhere in the ReplicatedStorage? Sorry, I’m just bad at it.

I’m a little slow right now, long day… One moment, I’ll try to process all the stuff you wrote here.

EDIT: For the full solution scroll down further and disregard this comment

It’s fine.

You can place a Script under the frame and change its RunContext property to “Client”. That means it will work like a localscript but anywhere as long as that place is replicated to the client (so yes in this case)

You can then create a second RemoteEvent preferably somewhere close to the other one so it can be called by the player.

Then, just plug the input of one RemoteEvent into the other.

*REMEMEBER to use TextFiltering service on the server at this stage

Sorry for my curiosity, but what would happen if I don’t use text filtering? Does it all get moderated, so it’s necessary, or not?

Roblox doesn’t allow slurs into chat yk. So your game would probably be moderated and shut down.

Nope, it does not.* That’s why you have to use TextFiltering service.

Once you get it up and running I will explain how to implement text filtering.

* What I mean is that Roblox does NOT automatically moderate the messages sent by RemoteEvents as they don’t necessarily know that the contents is a user-generated message

It would get moderated if even a couple players play the game, so make sure to filter text which was written by a player.

I didn’t know that. Joke

I did get it working, but for some reason It prints my nickname instead of the text, weird…

Can you send your scripts’ code (client AND server, all three) so I can take a look?

One moment, got to get off the PC for a bit.


I think I might have fixed it by deleting the b=a thing, I just thought that adding this would make it seem cooler or more functional.

Never use a server script for surfacegui handling.