Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I change the text box on a surface gui on a brick, with a gui?

Asked by 10 years ago

See screenshot: http://prntscr.com/527mas

PLEASE LOOK AT THE SCREENSHOT BEFORE YOU GO ON OR ANSWER

So, when I change the text in the screengui, I want the text box on a surface gui on a brick, to change to what I edit in the screengui!

Thanks, this will really help.

Aero.

P.S: If you do not understand, I'm happy to help.

1 answer

Log in to vote
1
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
10 years ago

There is a event of TextBox objects called FocusLost. This event fires after the player who clicked on the GUI presses enter or clicks away from the GUI. In you're case, I'm going to assume that you want to make sure that the player presses enter in order to transfer over the text.

(Make sure this is in a local script)

local screenTextBox = script.Parent -- Location of Textbox on the screen
local partTextLabel = game.Workspace.Sign.SurfaceGui.TextLabel -- Location of text on block

screenTextBox.FocusLost:connect(function(enterPressed)
    if enterPressed then -- Make sure they loose focus due to enter press
        partTextLabel.Text = screenTextBox.Text -- Change text
    end
end)

Ad

Answer this question