Textbx is not updating!

Hello Everyone!

i was working on a code system for my game using a serverscript in the gui button it is not working!

my script is not printing “Code Test” when i type “Test” in the textbox and i click the button no work

script.Parent.MouseButton1Click:Connect(function()
	local textBox = script.Parent.Parent.TextBox
	if textBox.Text == "Test" then
		print("Code test")
	end
end)

Whenever you type text into a TextBox, that typed text is only available on the client. Therefore, you need to have a local script which would transmit the text to the server, and the server would then process that text.

1 Like

ahh i see so i would have to make like a remote event?

Yes.

In the client script, you would fire the RemoteEvent with the textbox’s text.

In the server script, you would connect to OnServerEvent and then process that text (in your case check if it is equal to Test) and do the appropriate actions.

i could do like

game.ReplicatedStorage.Remotes.MainEvent.OnServerEvent:Connect(function(player, code)
	if code	== "Test" then
		print("Code Test")
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.