Search code examples
luaroblox

Why do Roblox textboxes always give a nil result?


My problem is that I'm trying to get a custom input from the user in the form of TextBoxes. More specifically, I want to give players a chance to input feedback about my Roblox Game but the text from the textbox keeps being nil even when I type something into it. I expect it's probably an error on my part but I'm a tad unsure.

So currently, it looks like this on the client:


script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Visible = false
    script.Parent.Parent.Feedback.Text = ""
    wait(.1)
    local success,nilmessage,Error = game.ReplicatedStorage.Feedback.SendFeedback:InvokeServer(script.Parent.Parent.Feedback.Text) --Invoking the server part.
    print ("Message RAW = "..script.Parent.Parent.Feedback.Text)--Checking the text
    --There's more stuff after here but this is the main part.
    
    
end)

The print statement always prints: Message Raw = and the server receives a nil value.

Any advice would be appreciated, if you need more, let me know.

Thanks for reading.


Solution

  • So as you say the print statement always prints Message RAW = ":

    Here you assign an emtpy string:

    script.Parent.Parent.Feedback.Text = ""
    

    and here you concatenate and print it:

     print ("Message RAW = "..script.Parent.Parent.Feedback.Text)
    

    So the print that you observe is what is to be expected.

    Why your server receives a nil value I cannot tell because you refuse to share the code on request.