How can I change the text of a textlabel on a surfacegui in workspace by inputting content from a textbox then clicking a textbutton?

Hi, I was wondering how I could make a textlabel change to whatever content was typed into a textbox in a screengui by clicking a button. Example: I type content into a textbox, click a button named “Enter”, then a textlabel on a surfacegui in workspace changes to whatever was in the textbox.

I’ve tried firing a remotevent and another solution, both didn’t seem to work.

The scripts I’ve tried:


GateEnter.MouseButton1Click:Connect(function()
GateTextBox.Text = Gate.Text

GateEvent:FireServer()
end)```

and

```local Screen = workspace.Screen
local Gate = ScreenGui.Frame.Gate
local GateTextBox = MainFrame.TextBoxs.GateTextBox
local MainFrame = DepartureBoardGui.MainFrame
local DepartureBoardGui = game.StarterGui.DepartureBoard
local GateEnter = MainFrame.Buttons.GateEnter

GateEnter.MouseButton1Click:Connect(function()
GateTextBox.Text = Gate.Text
end)```

None of these seemed to work.

Help appreciated. :)

How to grab text input from a TextBox? This could help you.