TextBox - Roblox GUI Tutorial #5 — Transcript
Full transcript
- 0:00bro what is this does this game think I'm a math professor or something oh okay what is 8 - 4 well
- 0:10if we really think about this if we're subtracting four from 8 we're literally taking away the four
- 0:16from the eight so I think the answer is just eight let me put that here and let's see what our result
- 0:21is bro all right let's think about my life choices for a minute okay but anyways what we just saw was
- 0:29a question that the game gave to us which was a math problem and we were able to answer this
- 0:34question by inputting a number inside of a little box and whatever answer we put inside of that box
- 0:41we clicked on the submit button to check whether the answer was correct or not and the way we were
- 0:46able to get this user input from the player was from a new guy element called a text boox which is
- 0:54the GUI element that I will be introducing inside of this episode so that we can get user input from
- 1:00the player through our GUI elements and in order to create a text box we're of course going to
- 1:06need to put this inside of a screen GUI so we're going to go to the right side of the Explorer hit
- 1:10the plus sign next to start GUI and we're going to insert a screen GUI we're going to call this
- 1:15main GUI and then we're going to hit the plus sign here and we're going to insert a text box
- 1:22so this is what our textbox should look like and we're able to drag this uh around like normal but
- 1:29you might notice that we can actually select this text box inside of our studio and right now it's
- 1:36selected or focused in this case so this indicates that we're able to type something inside of this
- 1:43text box so if I literally type in hello or just anything really then it's going to change the text
- 1:51of this text box to whatever I just typed in we can delete this and we can even deselect it so we
- 1:58can unfocus from it to where where it's just now a blank text box and like I mentioned we can just
- 2:04select it again so that we can focus on it and we can put in and we can put in a new text here
- 2:11like how are you doing and this is the cool thing about a text box is that it's kind of like a text
- 2:18label but if it was able to be changed by the user when they're playing the game that's kind of like
- 2:25an easy explanation I can give to text boxes and how they are used inside of inside of the
- 2:31game so that was just something I I wanted you to understand a little bit and I mentioned that when
- 2:36we select our text box we go into this Focus mode this is just called focusing on the text box and
- 2:44if we're not focusing from it anymore that's just called defocusing so those are just two
- 2:50terminologies that I want you to get a grasp at because there's going to be properties and events
- 2:57and functions that we're going to use that require you to know the difference between focusing and
- 3:02defocusing it's pretty easy so I think you pretty much get the basic understanding of that what I'm
- 3:08going to do now is introduce you to a bunch of properties that are specifically used for
- 3:13text boxes but before we do that let's make some changes to our text box so let's select this text
- 3:18box and let's just put in some sort of text here let's say Roblox is amazing now what we'll do is
- 3:27Select our text box and let's scroll down to the text category and let's make text scaled turned on
- 3:35and let's scale this so we can see it a lot easier and let's also reposition this to the center and I
- 3:42realize I'm going to have to type that again uh that's fine so we'll just go to the text
- 3:45label here and say Roblox is awesome all right so now that we have that let's scroll back up in the
- 3:52properties tab so the first property that I want to introduce that's unique to text boxes is called
- 3:59clear text text on focus and basically what this means is that when you focus on the text box that
- 4:05already has text on it it's just going to wipe away whatever text was originally on this text
- 4:13box so that you can put in some new text inside of here so we can just say Roblox sucks instead
- 4:21um in order to prevent this to where we defocus and focus back on it again we don't want it to
- 4:27just delete all the previous text that was there what we can do is turn off clear text on Focus so
- 4:35let's uncheck this and let's type in our original message let's say Roblox is awesome let's deselect
- 4:43it and then select it again and as you can see the text box did not wipe whatever text originally was
- 4:49in here so we could just continue off what we were trying to say with this text box prior so
- 4:55we could just replace awesome with Roblox is bad there's also another property called multi-line
- 5:01and basically what this means is that when you have this turned on you can create text that have
- 5:08multiple lines inside of the same text box so if I like so if I hit enter which drops down to the
- 5:14next line we're able to do this and we can just write text line by line so we can say nah Roblox
- 5:22is good and then we can just drop another line down here and then we can say meh I'm not sure
- 5:31and so we can just keep doing this over and over again but if we disable multi-line and we try to
- 5:38drop down to the next line it's not going to work if we just hit enter then it just simply deselects
- 5:43the text box we also have text editable which basically means if we have this turned on then
- 5:50whenever our player is playing inside of the game then we can select this current text label and
- 5:57update the text however we want it to um but if we have it turned off let's turn off text editable
- 6:04then the player will not be able to add any more text to it as you can see I'm trying to type on my
- 6:10keyboard right now and nothing is being put onto this text box because I disabled text editable so
- 6:17this is useful during the game when there's going to be certain periods where you just don't want
- 6:21the player to edit this edit whatever is currently in the text so I'd say that's pretty much the only
- 6:28time out finds text editable to be useful but I think that's just something good to know if
- 6:33we scroll down there are new properties related to the the text category so first thing we have
- 6:40this thing called a placeholder text and pretty much what this means is that if there is no actual
- 6:46text on this text box then Roblox is going to put in a text for you before the player actually does
- 6:55put a text inside of this text box so it's kind of like a default text before putting an actual
- 7:04text in there so let me show you what this looks like let's delete our text here and as you can see
- 7:11there's no text inside of our text box but it's kind of hard to tell that this is a text box other
- 7:16than our cursor change so one really neat way we can let the player know that this is a text
- 7:23box is by adding in a placeholder text so let's change this for instance to enter your answer
- 7:31here dot dot dot so Roblox is going to put in a default text here if you don't already have text
- 7:38here so if we select this then we can put in text inside of this text inside of this text box and
- 7:44the placeholder text will automatically go away being replaced by the text we just put in and if
- 7:50we leave the text property empty again then it'll just go back to the placeholder text so I say this
- 7:57is pretty neat to let the player know that this is supposed to be a text box that the player is
- 8:02supposed to input information into here and so that's pretty cool to know about another thing
- 8:05related to placeholder text is placeholder color 3 so by default it's this sort of grayish text color
- 8:12but if we click on this Square color then then we have a panel where we can choose whatever color we
- 8:18want I don't know dark green or something we can hit okay and this is going to be our placeholder
- 8:23text but our actual text is going to be whatever our text color 3 is and that's pretty much the
- 8:29general gist of it so now I want to introduce the scripting components of this text box and
- 8:35first we'll start with two events the first one being focused and the other one being focused
- 8:39lost so let's just insert a local script inside of our text box over here let's hit the plus sign
- 8:46hit local script let's delete this and we will make reference to our text box by saying local
- 8:52textbox equals script. par and down here we're going to create our first event we're going to
- 8:59to say textbox do focused colon connect function open parentheses close parenthesis hit enter so
- 9:09this event is basically going to fire whenever the player selects the text before they input any sort
- 9:16of information onto this text box so let's just do something simple by writing a print statement
- 9:22by saying print player has selected the text box and we can basically do the same thing when they
- 9:32go out of focus from this text box also known as deselecting the text box we can say textbox
- 9:39do Focus lost colon connect function so let's hit enter and let's write a print statement here by
- 9:48saying player has lost focus of the text box so these are the two events that'll simply activate
- 9:58whenever first the player selects the text box and then this will fire when the player defocuses
- 10:07from the text box so let's test this out really quick all right so I'm in the game when I focus
- 10:13on this text box it's now saying in the output player has selected the text box we can put in
- 10:20some random information here and if we deselect it then it's going to say player has lost focus
- 10:25of the text box and what's also interesting about defocusing is that if we select our text box again
- 10:33as long as we stay focused it's only going to print player has selected the text box one time
- 10:39it's not going to happen every time we click on this while we're still focusing on this text box
- 10:45however instead of just clicking away from this text box in order to deselect it we can also hit
- 10:51enter and this will also activate the focus lost event by saying player has lost focus of the text
- 10:57box and I believe this also works by hitting Escape as well so there are definitely a bunch
- 11:04of keys that act as losing focus of the text box like hitting enter or pressing escape or clicking
- 11:13outside of the text box so those are just stuff that you may should be that you probably should
- 11:19be aware of when you're trying to design your text boxes uh for your Roblox game so going
- 11:25back to focus lost there are two arguments here but the only one that's really important here is
- 11:30enter pressed input that cause Focus loss doesn't really matter all too much at least compared to
- 11:36enter pressed so our first argument is going to be enter pressed and this is the one we're interested
- 11:41in enter pressed is basically a Boolean that tells us whether the player lost Focus from this text
- 11:48box if they hit enter and not do anything else whether that was clicking away from the text
- 11:55box or hitting Escape so let's make that check down here by saying saying if enter pressed then
- 12:03this just implicitly checks whether the player has pressed enter well let's write a print statement
- 12:08by saying player hit enter to lose focus so now let's test this so let's just put some
- 12:16random stuff in here and let's hit enter we're going to see that not only did a print player
- 12:22has hit enter to lose focus but it also printed the other thing that was originally here player
- 12:27has lost focus of the text box now if we select this again and then hit Escape for instance all
- 12:34it's going to say is player has lost focus of the text box and not because the player has hit enter
- 12:39so that's something pretty interesting to know about let's say this is like a confirmation text
- 12:44box that you're trying to use for your systems and then finally we have three functions from the text
- 12:50box that I will be introducing in this episode so the first function is capture Focus which is
- 12:57basically forcing the player to automatically select this text box during a certain point in
- 13:03the game without the player doing it themselves so we're going to do that by going to our local
- 13:08script and let's quickly comment out these uh print statements so that our output will look
- 13:15a lot nicer when we test whatever it is we're going to test for the rest of the time so what
- 13:19we're going to do first is after about 5 Seconds we're going to force the player into focusing on
- 13:27the text box so what we're going to do is drop two lines down here and we're going to say task. wait
- 13:33put about 5 Seconds there and then down here let's say textbox colon capture Focus open parenthesis
- 13:43close parenthesis so this will basic so after about 5 Seconds the text box will force the player
- 13:49to capturing the text box and by doing this it's going to fire this focused event up here so that
- 13:57we can make it do whatever we want it to do so just for right now let's actually uncomment this
- 14:01again so that we can see whether this works or not let's test this out so after about 5 Seconds we
- 14:08should automatically be selecting this text box as you can see with this little blinking line at the
- 14:15very beginning while also saying here player has selected the text box so it's working as
- 14:19expected and we can deselect it if we wanted to the next function is called is focused and this
- 14:25is basically a getter function that just returns a Boolean as to whether the player is currently
- 14:30focusing on this text box and it goes something as simple as this so let's go to our local script
- 14:37and let's check to see in about 5 Seconds whether the player is still focusing on this text box and
- 14:44we're actually going to do this using a task delay rather than a task wait because we don't want the
- 14:49script to pause completely if this is the case so we're going to do this by saying task. delay open
- 14:56parentheses close parenthesis and we're going to put in the duration which is 5 Seconds comma and
- 15:01we're going to create a new function by saying function open parentheses close parenthesis enter
- 15:06so let's create a new Boolean here by saying local is focused equals textbox colon is focused open
- 15:16parentheses close parenthesis so this Boolean is going to tell us whether the player is still
- 15:20focusing on this text box after about 5 seconds so let's make that check by saying if is focused
- 15:28then what we will do is say print player is still focused on the text box so that's pretty much how
- 15:37it's going to work for this script right here so after about 5 Seconds the game is going to
- 15:43automatically make US capture this text box and it's going to call this focused event and after
- 15:49about 5 Seconds just by having the script delay for a little bit without actually stopping the
- 15:54script we're going to see if the player is still focused on the text box and if it is
- 15:58is then we're going to print this statement right here so let's go into the game and see our change
- 16:03all right so after about 5 Seconds the text label should automatically select the text lab the text
- 16:10box for us but after about another 5 Seconds it then displayed player still focused on the text
- 16:16box and we haven't made it do anything else yet we're still focused on this so this is where the
- 16:21last function comes in if we don't want this um to continuously be selected we can use a
- 16:29function called release Focus so this is what it's going to look like let's go to our local
- 16:35script and after about 5 seconds if the player is still focused on the text box let's make the
- 16:41script automatically defocus the player from the text box so that the player doesn't have to do
- 16:47it themselves so let's drop a line and let's say textbox colon release Focus open parentheses close
- 16:56parenthesis and there you go just like that let's go into the game and see our change all right so
- 17:01the text box automatically selected for us so in about 5 Seconds what should happen is that
- 17:06the script will automatically deselect this text box as shown right here so the script pretty much
- 17:13works as intended but there also is an additional parameter to this release Focus um function called
- 17:21submitted and we can basically add in a Boolean here of either true or false and pretty much
- 17:28this submitted argument tells us whether we want to override the enter pressed parameter inside
- 17:35of focus lost because as you know as soon as we release our Focus then Focus lost is automatically
- 17:42going to fire so we don't want enter pressed to be fired if we choose not to so what we can do is
- 17:50pass in a argument of Boolean true for submitted so that we can override this enter pressed
- 17:57parameter and we don't need to check for enter press because we already know that this submitted
- 18:03parameter is true I hope that makes a little bit of sense so that's pretty much the basics
- 18:07of text boxes I'm clearly not cut out to do math problems so I need to re-evaluate My Life Choices
- 18:13after this video is over but I hope you learned something new from this episode be sure to join
- 18:17my Discord server the link is in the description and I will see you in the next episode take care
About this transcript
This page contains the full transcript of TextBox - Roblox GUI Tutorial #5 by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 3,240 words across 170 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.