Viewport Frame - Roblox GUI Tutorial #16 (2025) — Transcript
Full transcript
- 0:00These are viewport frames, a very unique
- 0:03type of frame on Roblox that displays 3D
- 0:06objects on a 2D screen. This allows us
- 0:08to create things like shop display
- 0:10images, mini map systems, and many other
- 0:12things. And in this video, I'm going to
- 0:14be showing you how to create these
- 0:15viewport frames and use them for your
- 0:17own Roblox games. So, with that being
- 0:19said, let's get straight into the video.
- 0:21Now that we understand it, let's
- 0:23implement viewport frames inside Roblox
- 0:25Studio. So, just like what we do at the
- 0:27start of every single GUI episode, we're
- 0:29going to go to the right side inside of
- 0:31starter GUI, hit the plus sign, and
- 0:33we're going to insert a screen GUI. Now,
- 0:35inside of here, we're going to insert a
- 0:37viewport frame just like this. I'm going
- 0:40to scale it up just a little bit. Move
- 0:42it over here. I'm going to go down to
- 0:44the properties and change the size
- 0:46property to use off to use scale instead
- 0:49of offset. So, I'm going to say 0.2 0.2
- 0:53and then zero just like this. And then
- 0:55I'm going to rescale one more time and
- 0:57then move it to the corner just like
- 0:58this. All right. So, right now this
- 1:01looks like a pretty standard frame. But
- 1:02what's really cool about viewport frames
- 1:04is that we can take 3D objects and
- 1:08render them inside of a 2D space. And
- 1:11the way that we can do that, I'm
- 1:12actually going to show you a quick
- 1:13example of how we can do that is let's
- 1:16go to model and we're going to insert a
- 1:18part. And with this part, the way that
- 1:20we render objects inside of a viewport
- 1:23frame is to directly put these models
- 1:25inside the viewport frame itself. So I'm
- 1:28going to take this part and drag it
- 1:29inside the viewport frame. And now, as
- 1:31you can see, the part is being rendered
- 1:34inside of this viewport frame rather
- 1:36than our in-game workspace as you can
- 1:38see over here. Now, you might be
- 1:40thinking that this is actually kind of
- 1:42like a weird position for this part to
- 1:44be in. Like why does it look like that?
- 1:45It looks like that because Roblox is
- 1:47using a fixated camera that's set in the
- 1:51the origin of the game and we can't
- 1:53exactly change the position of this
- 1:55camera unless we create our own camera
- 1:58or change it to a different one. And we
- 2:00can actually do that through a specific
- 2:01property. So if we go to viewport frame,
- 2:03there should be a property here called
- 2:05current camera. And we can actually
- 2:08change this camera to be something
- 2:09different. Let's say we were to select
- 2:11this and change this to our studios
- 2:14camera. Then what it's going to do is
- 2:16it's going to replicate the studio's
- 2:19camera inside this viewport frame. So if
- 2:21we move around inside the world, then
- 2:23the viewport frames camera is also going
- 2:26to mimic what the studio's camera looks
- 2:28like currently, which is actually really
- 2:30cool. But the thing that's unpractical
- 2:32about this is it doesn't exactly work
- 2:33when we play the game. So if we go and
- 2:35hit test and hit play, then what we
- 2:37should see is that this viewport frame
- 2:40is no longer updating with the in-game
- 2:42camera. And that's because there's a
- 2:45difference between the studios camera
- 2:47and the in-game camera. So, if we play
- 2:50the game, Roblox is essentially creating
- 2:51a copy of the studio camera and putting
- 2:54it inside of this viewport frame without
- 2:57updating it because we're not using the
- 2:58studios camera. This is our in-game
- 3:00camera. So, there definitely are some
- 3:02tricks that you have to look out for
- 3:03when you're using viewport frames. But,
- 3:05this is essentially what a viewport
- 3:06frame is. And we can do some pretty cool
- 3:08stuff with the part that's inside this
- 3:09viewport frame. So, what I'm going to do
- 3:11is hit the plus sign in viewport frame.
- 3:13I'm going to insert a local script. And
- 3:15what we're going to do inside of the
- 3:17script is make it so that the part
- 3:19inside this viewport frame is going to
- 3:20constantly spin around. And what we're
- 3:22going to do inside the script is first
- 3:24make our own custom camera that we can
- 3:27manipulate. And second, we're going to
- 3:28write some lines that makes the parts
- 3:31spin around so that we can see that it's
- 3:32actually moving. So, the first thing
- 3:33we're going to do is say local viewport
- 3:36frame equals script.parent. And then
- 3:38what we're going to do is say local part
- 3:40equals viewport frame.part. So now what
- 3:43we're going to do is create our own
- 3:46viewport camera. So we're going to say
- 3:48local viewport
- 3:50cam equals instance new camera. And then
- 3:53what we're going to do is set the origin
- 3:56of the viewport cam. So we're going to
- 3:57say viewport cam.cf frame equals Cframe
- 4:01new 0000. But we can change this to a
- 4:04different value later because right now
- 4:06this is the standard C frame value for a
- 4:09C frame when you do create it. So then
- 4:11what we're going to do is we're going to
- 4:13set the viewport frames current camera
- 4:17to this camera that we just created
- 4:19here. So we're going to say viewport
- 4:22frame.curren camera equals viewport cam
- 4:25just like this. So, this creates a new
- 4:28viewport camera specifically for this
- 4:30viewport frame that we can now
- 4:31manipulate, which is what we're going to
- 4:32do later. But as of right now, what
- 4:34we're going to do is say while true do,
- 4:37we're going to put a task. And above
- 4:40here, we're going to make the part spin
- 4:42around constantly. So, we're going to
- 4:44say part C frame times equals the parts
- 4:48C frame with Cframe.
- 4:51And let's make it spin around on the
- 4:53Yaxis. So, we're going to say zero. And
- 4:55if we're going to use degrees, let's say
- 4:57math.RAD. So we're going to put this in
- 5:00radians. And then we're going to put one
- 5:01degree here. And then for Z, we're just
- 5:03going to say zero. So now if we go into
- 5:05the game and hit test and hit play, then
- 5:08what we should see in this viewport
- 5:10frame is we can now see that the part is
- 5:13spinning, but it's still kind of like
- 5:15out of reach. We can't really see it
- 5:16that well. And that's because we can now
- 5:19take our viewport camera and modify
- 5:22where the position of this camera is. So
- 5:25on the Z, let's say we want to put five.
- 5:28So what this viewport frame is going to
- 5:30do is we can now see that it's like a
- 5:32little farther away. Uh I think what I
- 5:34actually wanted to do was make it a
- 5:35little closer. So if I were to go back
- 5:37to the script and make it let's say -10,
- 5:40then I think we should definitely see a
- 5:41difference with this viewport frame
- 5:43here. So as you can see, the part is now
- 5:45closer to the camera. Um, and we can now
- 5:48modify our viewport camera to change
- 5:51where it's positioned inside of this
- 5:54viewport frame to basically showcase the
- 5:57parts inside of here more accurately.
- 5:59And I hope that this part is making
- 6:00sense so far. Now, you might be
- 6:01thinking, is it possible to render a
- 6:04model inside of a viewport frame? And
- 6:06the answer is yes. You actually can
- 6:08render a model inside of a viewport
- 6:10frame. And one of the best examples that
- 6:13I can showcase this is through our own
- 6:16character to be displayed inside this
- 6:17viewport frame. So what I'm going to do
- 6:19is go to test and then hit play. And
- 6:22what we're going to do is copy our
- 6:24character from the workspace. So I'm
- 6:25going to open up workspace, then go to
- 6:27our character. I'm going to rightclick,
- 6:29copy, and then I'm going to hit stop.
- 6:31And then inside the workspace, I'm going
- 6:33to rightclick and then hit paste into
- 6:35just like this. And now what I'm going
- 6:37to do with our character is drag it into
- 6:39the viewport frame. so that it's going
- 6:41to be rendered just like this. Um, but
- 6:44in order for us to have a clear view of
- 6:48our character when we render it inside
- 6:49the game. So, we want it to look
- 6:51something like this. Uh, and the way
- 6:52that we can achieve this specific angle
- 6:55for the camera is having to create our
- 6:58own camera to make it be positioned like
- 7:00this when we play the game. So, what
- 7:03we're going to do is inside the viewport
- 7:04frame, we're going to hit the plus sign
- 7:06and we're going to create our own camera
- 7:08just so that we can see what it looks
- 7:10like inside studio so that we can use
- 7:12our script to replicate the same camera
- 7:15position. So, for our new camera's
- 7:17position, I'm going to set it to 0 0.
- 7:19And then for the orientation, I'm also
- 7:21going to set it to 0 0. And then what
- 7:23I'm going to do is go to the viewport
- 7:25frame. I'm going to go down to current
- 7:27camera and then select our new camera
- 7:29that we created. So with this, what
- 7:31we're now going to do is try to make our
- 7:34character in view of the camera. So for
- 7:38our character, I'm going to set the
- 7:40origin position to 00.
- 7:44So now it might look a little off frame
- 7:46right now. So we need to readjust some
- 7:48values to make it in view. So we're
- 7:50going to go to the camera and I'm going
- 7:52to set the C frames position to 005.
- 7:56And it looks like our character is now
- 7:58facing the other way. So, what we can do
- 8:00is set the orientation of our character
- 8:04to, let's say, 180° on the Y-axis. And
- 8:06there we go. Now, we can see our
- 8:08character inside the frame. Now, in
- 8:10order for us to see it in the actual
- 8:11game, we need to modify our script to
- 8:14replicate the same exact camera, but
- 8:16instead create it inside the script
- 8:17instead. So, what we're going to do is
- 8:19go into the script and we're going to
- 8:22change the position of this viewport
- 8:24camera to 0 0 and whatever we put here.
- 8:28Yeah. 0 0 5 just like that. So now if we
- 8:31go into the game, hit test and hit play,
- 8:33then what we should see is our character
- 8:36is perfectly in the viewport frame as we
- 8:39wanted to. And this is how you render a
- 8:42model inside of a viewport frame. But
- 8:44what if I told you that there are some
- 8:46other pretty cool things we can do with
- 8:47this? Like we can animate our character
- 8:50inside of this viewport frame uh rather
- 8:52than just having our character stand
- 8:54still just like this. Now,
- 8:55traditionally, what we would do is if I
- 8:57were to hit stop, we would typically,
- 8:59let's say, run an animation for our
- 9:01character and then we'd be able to see
- 9:03it inside of the viewport frame. But the
- 9:05problem is is viewport frames don't
- 9:08actually apply physics to any models
- 9:11that are inside of the viewport frame.
- 9:14Because if this was the case, then our
- 9:16character should have like an idle
- 9:18animation here, but it simply just
- 9:20doesn't because it can't play physics or
- 9:22any type of animation. So, a solution to
- 9:24this would be to wrap our models inside
- 9:27of what are called world models. And I'm
- 9:29going to show you what this looks like.
- 9:30So, inside of our viewport frame, we're
- 9:32going to hit the plus sign, and we're
- 9:33going to insert a world model that looks
- 9:36like this. And anything that we add
- 9:39inside of here is going to allow physics
- 9:41to be enabled for any of the objects
- 9:43that we put inside of it. So, I'm just
- 9:45going to drag our character and put
- 9:46inside the world model. And now if we
- 9:48hit play,
- 9:50what we should see is our character now
- 9:53has its idle animation playing. And if
- 9:55we wanted to do other things with it, we
- 9:57can now do it because we put our
- 10:00character inside of a world model. So
- 10:03that's the purpose of what a world model
- 10:04does. And now let's try and make a cool
- 10:07little animation with this. So I'm going
- 10:08to hit stop. And what I'm going to do is
- 10:10let's say we want to make a script that
- 10:13plays like a dance animation for this
- 10:15character just for the heck of it. I'm
- 10:17going to try and look for an animation
- 10:19that we can play. So I'm just going to
- 10:21click on animate. And there should be a
- 10:23bunch of animations that we can pick
- 10:25from here. Uh so I'm probably going to
- 10:27pick dance and I'm going to pick one of
- 10:29these animations. If you don't see this
- 10:31option, it's probably because you
- 10:33imported an R six character rather than
- 10:35an R15 character. Uh but you can use any
- 10:37of these animations. It really doesn't
- 10:39matter which one you pick. So, I'm going
- 10:40to pick animation one from the dance
- 10:42animation. So, I'm just going to take
- 10:44this, copy it, and I'm going to create a
- 10:47new script inside of our character. So,
- 10:49I'm going to hit the plus sign, insert a
- 10:51local script, and I'm just going to
- 10:52paste the animation inside of here, and
- 10:54I'm going to rename this to
- 10:57dance script, just like this. Okay. And
- 11:00now what we're going to do is first
- 11:02locate the animation. So, I'm just going
- 11:03to rename this to animation. So, I'm
- 11:06going to say local animation equals
- 11:09script.an animation. And then what I'm
- 11:11going to do is say local animator equals
- 11:14script.parent
- 11:16colon wait for childh humanoid. And we
- 11:19want to locate the animator of the
- 11:20humanoid. So, we're going to say wait
- 11:22for child animator just like this. And
- 11:24then we want to load the animation. So,
- 11:26we're going to say local uh loaded
- 11:29animation equals animator colon load
- 11:34animation. And then we want to load the
- 11:35actual animation to it. And then what
- 11:37we're going to do is say loaded
- 11:39animation colon play open close
- 11:43parenthesis just like that. And this is
- 11:44how we're going to be playing the dance
- 11:46animation as soon as we join to the
- 11:48game. So now we're basically done with
- 11:50that. So if we hit play, then what we
- 11:52should see is our character should be
- 11:54playing a little dance animation. As you
- 11:56can see right here, it's uh it's pretty
- 11:58cool what you can do with viewport
- 12:00frames. Uh you can even add backgrounds
- 12:02if you really want to. You can change uh
- 12:04some lighting properties which I'm
- 12:06actually going to show you right here.
- 12:07So, if we go to our viewport frame, we
- 12:09have a bunch of settings that we can
- 12:11work with. We have an ambient setting to
- 12:13mess around with the lighting a little
- 12:14bit. We have a light color if we want to
- 12:19change that property as well. We even
- 12:21have a light direction and some other
- 12:23properties that we can just mess with
- 12:24here to make it look better for what
- 12:26we're trying to accomplish here. And I
- 12:28hope that this is helping you understand
- 12:29how you can apply viewport frames to
- 12:32your game through what I've been able to
- 12:34teach you so far. One thing I would like
- 12:35to add is we can use viewport frames and
- 12:38apply them to a surface GUI inside the
- 12:41game, which I think is pretty cool. Now,
- 12:42if you need a recap of what surface gys
- 12:44are, so let's say if I were to insert a
- 12:47part here and just scale it like this, I
- 12:49want to apply a GUI screen onto a
- 12:53specific side of this part. Let's say
- 12:55this one. uh we would be able to add a
- 12:57viewport frame to the surface of a 3D
- 13:00object like this one, which I think this
- 13:02is pretty cool. Uh so I'm going to show
- 13:03you how to do this really quick. So what
- 13:05I'm going to do is inside the screen
- 13:07GUI, I'm going to insert a surface GUI.
- 13:11And then within the surface GUI, I'm
- 13:13going to set this adorny property to
- 13:15this part right here. So I'm just going
- 13:17to select that. And now what we're going
- 13:19to do is take this viewport frame. I'm
- 13:22going to copy it and I'm going to paste
- 13:24it inside of here. And now you can see
- 13:26that this viewport frame is a part of
- 13:29this wall right here. So if we were to
- 13:31go to the game, hit test and hit play,
- 13:32then what we should see is the exact
- 13:34same result of my character just dancing
- 13:37all about like this. It's uh it's kind
- 13:40it's kind of freaky looking, but I mean
- 13:41this is still something really cool you
- 13:43can do with viewport frames. And I
- 13:44figured that I would show this to you in
- 13:46case you ever decide to use this inside
- 13:47of your Roblox games. So, with what we
- 13:49have so far, we're about to create
- 13:50something pretty interesting with this
- 13:52viewport frame. So, what I have here is
- 13:55a system where if I were to hover over
- 13:57this viewport frame with my mouse, then
- 14:00what it's going to do is it's going to
- 14:02rotate the character around this
- 14:05viewport frame, kind of like a display
- 14:07showcase type of thing. And basically
- 14:09how it works is when I initially hover
- 14:11over, it's going to zoom the character
- 14:13in and then it's going to constantly
- 14:15rotate the character around until I
- 14:18hover my mouse out of it. And I've seen
- 14:20this a lot inside of shop systems where
- 14:22if we want to display like a model of
- 14:25some sort, then we can have it where if
- 14:27you hover over it, then it's just going
- 14:28to showcase it so that you're able to
- 14:30see it properly so you can see the
- 14:32entire thing. And I think this is a
- 14:33really cool system to make and that's
- 14:34what we're about to be making with what
- 14:36we know about viewport frames so far.
- 14:38Okay, so the first thing that we would
- 14:39need to do is go to our local script.
- 14:42And we probably don't need this code for
- 14:45the part spinning thing anymore because
- 14:47we're not really going to be using that.
- 14:49So let's just delete that. And also
- 14:50delete the reference to the part. Okay,
- 14:52so what we need to do is create two
- 14:54events. One for hovering our mouse into
- 14:57the viewport frame and one for hovering
- 15:00our mouse outside of the viewport frame.
- 15:02So inside of our script, we're going to
- 15:03say viewport frame dot mouse enter colon
- 15:08connect function open and close
- 15:11parenthesis enter. And this does bring
- 15:13us two parameters that we're probably
- 15:15not going to be using. So we're just
- 15:17going to leave this empty. And then
- 15:18we're going to do the same thing for
- 15:19mouse leave. So we're going to say
- 15:21viewport frame mouse leave col connect
- 15:24function open and close parenthesis
- 15:25enter. Just like that. Okay. Now,
- 15:29another thing that we need to do is make
- 15:30a bunch of references to a couple
- 15:32things. And the first thing that we need
- 15:34to make reference to is our character,
- 15:35which I think to make it easier, what we
- 15:37can do is go to our character. I'm just
- 15:40going to rename this to character just
- 15:42like this, so that it'll be easier to
- 15:44reference. So, we're going to say local
- 15:46character equals viewport frame.orld
- 15:50model character just like that. Now,
- 15:52another thing we need to make reference
- 15:54to is a debounce variable to check
- 15:57whether our mouse is currently hovered
- 15:59over the viewport frame or not. So,
- 16:01we're going to say local mouse entered
- 16:06equals false. Just like that. And one
- 16:09thing that we need is a default C frame.
- 16:11And I'm going to show you why we need
- 16:13this in a second. But first, we're going
- 16:15to set it as a default value of where
- 16:18our character is currently positioned.
- 16:20So if I were to let's say select our
- 16:22character, we can see that the default
- 16:24position is at 0 0. So that's what we're
- 16:28going to do here. So we're going to say
- 16:29local default C frame equals C frame new
- 16:35open close parenthesis 0 0. Now you
- 16:37might notice that the default
- 16:39orientation is -1 180. So we also need
- 16:42to specify that inside of our default C
- 16:44frame as well. So we're going to
- 16:46multiply this by C frame. angles so that
- 16:49we can apply a rotation to this. We're
- 16:51going to say 0 math.
- 16:55And then we're going to put 180° here
- 16:58and then zero for Z. So once we have
- 17:02this, we also need one more reference
- 17:04which is going to be a connection
- 17:06variable for when we run run services
- 17:09render stepped function. And I'm going
- 17:11to explain what that means later. But
- 17:13let's just type in local rotation
- 17:16connection. And we're not going to set
- 17:18this to anything right now. Okay. So now
- 17:20what we're going to do is inside of this
- 17:21mouse enter event, first thing we want
- 17:23to check is if the mouse is not
- 17:25currently entered. So we're going to say
- 17:27if not mouse entered, then we're going
- 17:29to set mouse entered equal to true. And
- 17:32this is where we can make it so that the
- 17:34character zooms in for a second and then
- 17:37it continuously rotates until the user
- 17:41lets go of their mouse uh outside of the
- 17:43viewport frame. So, if I were to show
- 17:44you what this would look like, let's say
- 17:46we have our character here, and we're
- 17:48trying to apply changes to the
- 17:52character's primary part, which for most
- 17:54characters, it's this humanoid root part
- 17:56here. So, if we were to make changes to
- 17:58this humanoid root part, then what it's
- 18:00going to do is it's going to apply it to
- 18:02all the other parts of the character
- 18:04because it's all contained inside of one
- 18:06model here. And the humanoid root part
- 18:09is the controller of all position and
- 18:12rotation changes. So how this is going
- 18:15to look is if we were to hover our mouse
- 18:17over, then we're going to zoom in the
- 18:19character just like a little bit like
- 18:20this. And then once we do that, we're
- 18:22going to continuously rotate this
- 18:24character until the user lets go of the
- 18:27mouse out of the viewport. And then it's
- 18:30just going to reset it back to its
- 18:32default C frame like we did before. So
- 18:35now that we have that understanding,
- 18:36let's go back to our script and we're
- 18:37going to use tween service to move the
- 18:39character inward. So we're going to drop
- 18:41a few lines up here. We're going to make
- 18:43reference to tween service by saying
- 18:45local tween service equals game get
- 18:48service tween service just like this.
- 18:50And then we're going to create a tween
- 18:52here. So we're going to say local tween
- 18:54in equals tween service create open and
- 18:57close parenthesis. So, we're going to
- 18:59take the characters primary part, which
- 19:02as I said before, this is the humanoid
- 19:04group part. And then we're going to give
- 19:06a tween info. So, we're going to say
- 19:08tween info.n. And the only thing that we
- 19:10really care about here is how long it
- 19:12takes. So, we're going to say this is
- 19:14going to last for 0.25 seconds. And then
- 19:16we want to set a property table of the
- 19:19goal that we want to achieve, which in
- 19:20this case is the C frame. So we're going
- 19:23to say C frame equals default C frame
- 19:28plus default C frame.look vector. So the
- 19:32look vector is basically this direction
- 19:34right here that gives us a a bunch of
- 19:37values that contains ones and zeros. And
- 19:39if we add the look vector to this, then
- 19:41it's going to move this character one
- 19:44stud towards the camera. So once we have
- 19:46this taken care of, now what we can do
- 19:48is play the tween. So we can say tween
- 19:51in colon play just like this. So now
- 19:54what we're going to do is update our
- 19:55mouse leave function. So we're going to
- 19:57say if mouse entered then we're going to
- 20:00set mouse entered equal to false. And
- 20:03we're going to essentially take the same
- 20:05code that we had here, but instead we're
- 20:07going to push the character back instead
- 20:10of bringing it into the camera. So we're
- 20:12going to copy this, paste it in here.
- 20:14We're going to rename this to tween out.
- 20:17And then what we're going to change here
- 20:19is the C frame property. So instead of
- 20:22default C frame plus default C frame
- 20:24look vector, we're just going to have
- 20:25default C frame just like this. So now
- 20:28what we should see is if we go inside
- 20:30the game and hit play and if we hover
- 20:32over our viewport frame, then we can see
- 20:34that our character is now zoomed in once
- 20:36we hover over. But then once we hover
- 20:38out, it's going to zoom back out. So now
- 20:40the thing that we need to add is the
- 20:43ability to rotate or spin the character
- 20:47while the player has their mouse hovered
- 20:48over. So that's the next thing that
- 20:50we're going to do here. So if I hit
- 20:52stop, then what we're going to do is go
- 20:53back to our local script and we need to
- 20:55make reference to run service because
- 20:57we're going to run this every single
- 20:59frame so that it updates smoothly when
- 21:01the character rotates around. So what
- 21:03we're going to do up here is say local
- 21:05run service equals game get service run
- 21:09service just like this. And once we play
- 21:12the tween we want to wait for the tween
- 21:14to finish before we activate the spin
- 21:16function. So what we're going to do is
- 21:18say tween in completed
- 21:22colon connect function open close
- 21:24parenthesis enter. Now just for a quick
- 21:26check what we're going to do is say if
- 21:28mouse entered then just to be safe. And
- 21:31now what we're going to do is take our
- 21:33rotation connection and we're going to
- 21:36apply run services render stepped
- 21:38function. So we're going to say run
- 21:40service dot render stepped. And the
- 21:43reason we're using render stepped is
- 21:44because this is a local script and
- 21:46render stepped is something we can
- 21:48exclusively use for local scripts
- 21:50instead of normal scripts. So if we want
- 21:51to get like the right amount of
- 21:53smoothness, I think render stepped is
- 21:54the best function to use. So then we're
- 21:56going to say connect function open close
- 21:58parenthesis enter just like this. And
- 22:00now what we're going to do is basically
- 22:03spin the primary part just like we did
- 22:05with that regular part earlier in this
- 22:07tutorial. So what we're going to do is
- 22:09say character primary part doc frame and
- 22:13then we're going to multiply equal
- 22:16whatever the C frame of this primary
- 22:18part currently is with CF frame angles
- 22:22open close parenthesis. And then we're
- 22:23going to say zero math.rad. We want to
- 22:26apply one degree to the turn every
- 22:29single frame. And then for the Z, we're
- 22:31just going to say zero. Okay. So now our
- 22:34mouse enters complete, but we want to
- 22:35make sure that when the player hovers
- 22:38their mouse out of the viewport frame,
- 22:40then we want to disable this render
- 22:43stepped connection. So down here, what
- 22:46we're going to do for the mouse leave is
- 22:47say if rotation connection. So if
- 22:50there's a current connection right now,
- 22:53then what we're going to do is
- 22:55disconnect the connection. So we're
- 22:57going to say rotation connection colon
- 23:01disconnect. Just like that. And we also
- 23:04want to make sure that rotation
- 23:05connection is also set equal to nil as
- 23:07well. So we're going to say rotation
- 23:08connection equals nil. And that gets rid
- 23:11of the variable since we don't need it
- 23:13anymore. And this is our complete script
- 23:16for our rotation model viewport system
- 23:20that we created I guess. So if we hit
- 23:22play then we should see our finished
- 23:25result. So if I hover my mouse in then
- 23:27we should see that first it zooms the
- 23:30character in and then it spins the
- 23:32character continuously until I stop uh
- 23:36hovering over my mouse over this
- 23:38viewport frame. So if I let go then it's
- 23:40going to go back to where it started.
- 23:42And I think this is something really
- 23:44cool that we can make with viewport
- 23:46frames. Um, now I kind of noticed that
- 23:49the character is like zoomed in quite a
- 23:51lot. So I'm going to uh make the
- 23:53starting C frame six for the camera
- 23:55instead of five. And I think that should
- 23:58basically update the camera to be where
- 24:00we want it to be. So now we can see more
- 24:02of the character when we zoom in and
- 24:04then do the rotation and then stop it.
- 24:06So that is basically how we use viewport
- 24:07frames inside of Roblox Studio. Big
- 24:09shout outs to my Patreon members for
- 24:11their continued support to help me
- 24:13continue making high-quality tutorials
- 24:15for you guys to watch and also just
- 24:17great videos in general for the channel.
- 24:19If you enjoyed this video, then I
- 24:20encourage you to leave a like or maybe
- 24:22leave a comment of what you plan to do
- 24:24with this tutorial on viewport frames
- 24:26inside of your own Roblox games. And
- 24:28with that being said, I think that's
- 24:30pretty much going to conclude this
- 24:32episode on viewport frames. I had a lot
- 24:34of fun making this tutorial and I will
- 24:36be seeing you in the next video.
About this transcript
This page contains the full transcript of Viewport Frame - Roblox GUI Tutorial #16 (2025) by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 4,971 words across 666 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.