Script won't change SurfaceGui

Should be fairly simple to try something like this:

local pushEnter, pushCancel
pushEnter = gui1.MouseButton1Click:Connect(function()
    --remote:InvokeServer(text)
    --same as remote.InvokeServer(remote, text)
    gui1.Active = false
    gui2.Active = false
    textbox.Active = false
    local success, result = pcall(remote.InvokeServer, remote, textbox.Text)
    if success and result then
        closeGui()
        --[[ 
              you would not need to do the below if you :Destroy() the gui, 
              but usually you do not want to do this as it is very easy 
              to just move it out the way without having to make a new one each time
        ]]--
        pushEnter:Disconnect()
        pushCancel:Disconnect()
    else
        tryAgainText()
        gui1.Active = true
        gui2.Active = true
        textbox.Active = true
    end
end)
pushCancel = gui2.MouseButton1Click:Connect(function()
    closeGui()
    pushEnter:Disconnect()
    pushCancel:Disconnect()
end)

Why use MouseButton1Click if it’s a TextBox?

You just said you would use a button lol
This is an example with a Send and Cancel button

I said I would use a button, the player needs to be able to enter the text into the textbox.

I mean thats the point, they enter the text and then push the button. I don’t see why you don’t understand. If you want it to update frequently as they type the text, I don’t recommend that. I would just send the text once theyre done typing, i.e. with the FocusLost event. But it is literally the same process.

1 Like

hm, okay. Yeah, I see what you meant. I thought you meant use a single textbutton. Yeah, I got it. I’ll try this in a few minutes and see how it works :slight_smile: