I can't get Textbox Text from Client to Server

Hello. I am working on this game. For myself, and a friend of mine. And I can’t seem, to figure this out, no matter the outcome. I have tried, multiple ways of solutions. And still nothing, to be found, to work.

Problem:

I keep having a Remote Event print the Player whom is firing the Event. I can’t get it, to simply print the Textbox Text, on the Client, to the Server, from the Remote Event, as a carried over variable, of the Textbox text, on Remote Event. How do I get it to stop printing the Player.

My Code:

Client:

	if StoreNameText.Text ~= "" then
		UpdateEvent:FireServer(StoreNameText.Text)
	end
end)```

Server:

UpdateEvent.OnServerEvent:Connect(function(Text)
	print(Text)
end)

An .OnServerEvent always has the player who fired it as first parameter, you can get the text from the 2nd parameter, like so:

UpdateEvent.OnServerEvent:Connect(function(plr, Text)
	print(Text)
end)
1 Like

The first parameter/argument of the connect function inside the OnServerEvent is ALWAYS the player instance who fired the remote event. So you should add another argument to supply the Text.

It worked! Thank you so much. I appreciate it.

Don’t forget to mark it as solution so other people wiith the same problem can also find this! And you’re welcome of course!

1 Like