Hello, I'm trying to make a bindable function that after the player clicks on the text box, types something in, and then clicks enter/return it stores the word in the server and then prints it in the output. Now everything on the typing side works, It even prints out on a surfacegui. The problem is that if I try to run the code I get the error "attempt to call a nil value". Here's my code.
local screenTextBox = script.Parent -- Location of Textbox on the screen
local partTextLabel = game.Workspace.BlueTeamGameRoom.BlueGameBoard.Board.SurfaceGui.TextBox -- Location of text on block
local gui = script.Parent
while true do
wait(.5)
screenTextBox.FocusLost:connect()
partTextLabel.Text = screenTextBox.Text -- Change text
end
screenTextBox.FocusLost:connect(function(enterPressed)
if enterPressed then -- Make sure they loose focus due to enter press
local DBallz = game.ReplicatedStorage.answerVerify:Invoke()
print(DBallz)
end
end)
Does anyone have any clue why?

4 comments
InvokeServer()
@greatneil80 tried it, I still got the exact same error. I used OnServerInvoke too, still nothing. Also the intellisense didn't suggest it so I don't think this is it
at which line did the error occur?
@Gmorcad12345 Yk for some weird reason the doesn't even say what script it's part of let alone what line it occurs at. all I know is that it occurs when i press enter in the textbox