Minimap - Roblox Scripting Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.พ. 2025

ความคิดเห็น • 144

  • @sinklz
    @sinklz 2 ปีที่แล้ว +16

    Really good tutorial. The work you're putting into these tutorial videos is much appreciated by the community!

  • @KebeMaro
    @KebeMaro 2 ปีที่แล้ว +10

    You never cease to amaze me with the new unique tutorials!

  • @ultra_9861
    @ultra_9861 ปีที่แล้ว +2

    i found the name of your channel in the comments of a roblox studio video
    that was the best discovery i have ever made
    it is really interesting to see how this minimap is made and why is it made like this
    you are literally one of my favorite youtubers now. no joke

  • @gdetonator1182
    @gdetonator1182 2 ปีที่แล้ว +3

    A very helpful tutorial keep up the work 👍

  • @M11NGO
    @M11NGO 2 ปีที่แล้ว +1

    Been looking for a tutorial like this for my go karting game for ages wow.

    • @M11NGO
      @M11NGO 2 ปีที่แล้ว

      How would I go about making it spin like in racing games, like the map?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      clip decedents and rotating GUI do not work together unfortunately so you would have no choice but to use the full viewportframe and always update the viewports camera so you would not be able to use the optimizations I show in this video if you want to rotate the minimap :(

    • @M11NGO
      @M11NGO 2 ปีที่แล้ว

      @@5uphi Ahh glad you told me, also my game has a custom first person that moves as the mouse is moving how could I fix my player's position on the map because it goes normal when I return to third.

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Make sure to set the cameras focus in your custom camera script

    • @M11NGO
      @M11NGO 2 ปีที่แล้ว

      @@5uphi I'm trying to see what you mean, I never knew you could even do that. And it shouldn't mess anything up right? sry about the questions.

  • @Khaled-bx2zg
    @Khaled-bx2zg 2 ปีที่แล้ว +2

    thanks a lot for explaining everything in detail, you deserve more followers! keep up the outstanding work! also can you make a working blade with very good hitbox mechanics thx alot!

  • @mosquito2712
    @mosquito2712 2 ปีที่แล้ว +8

    my head trying to understand everything: 🤯🤯

    • @BurnTheDemon1
      @BurnTheDemon1 8 หลายเดือนก่อน +1

      migraine…

    • @tfx9223
      @tfx9223 7 หลายเดือนก่อน +3

      You’re better off learning Lua concepts rather than bashing your head against tutorials

  • @HingerYT
    @HingerYT ปีที่แล้ว

    Works really well! Thanks for the tutorial!

  • @cyrusdevs
    @cyrusdevs 2 ปีที่แล้ว +1

    Bro I think I just found out that you have a bot that writes the stuff for you. I hear you making some combination on your keyboard to start it. If I'm wrong, you're probably holding Ctrl+Y or Ctrl+Z or you're typing is just perfect. Keep up the good work btw

    • @5uphi
      @5uphi  2 ปีที่แล้ว +2

      Ctrl + Alt + V

    • @cyrusdevs
      @cyrusdevs 2 ปีที่แล้ว

      @@5uphi wait its that simple?

    • @cyrusdevs
      @cyrusdevs 2 ปีที่แล้ว

      @@5uphi it doesnt work

    • @GhettoWxzrd
      @GhettoWxzrd ปีที่แล้ว +1

      @@cyrusdevs his AI needs an update.

  • @YTDani75
    @YTDani75 ปีที่แล้ว +2

    So I've seen the comments about terrain and how the solution would be to represent terrain via parts, but couldn't I just take a screenshot of the entire map from above or draw it and then put it onto the frame while still having the character walk on it?

    • @5uphi
      @5uphi  ปีที่แล้ว +2

      Yes that is also an option then you don't need a viewport frame simply use a image label

  • @G_kendall
    @G_kendall 2 ปีที่แล้ว +1

    hey, im having a problem to where the viewport is outside of the frame

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      the viewport should go outside the frame but when you enable ClipsDescendants it should hide the parts outside the frame but if you rotate the frame then it wont hide it so make sure the rotation is set to 0

  • @seasoncookie
    @seasoncookie 2 ปีที่แล้ว +1

    This is a amazing tutorial !

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Thank you

  • @ruadhandarcy8111
    @ruadhandarcy8111 2 ปีที่แล้ว

    Goat youtuber keep up the good work 👏

  • @thegameinglemon1072
    @thegameinglemon1072 2 หลายเดือนก่อน

    This is great, but I don't imagine this scaling well. For my old map system, I used the RoRender plugin to render the map to an image and used a similar concept for moving the image around based on the player's position. However, I am revamping many parts of my game, including this system. And while it worked fine before, it does come with the caveat of re-rendering the map to see changes. Any suggestions on large-scale maps?

    • @5uphi
      @5uphi  2 หลายเดือนก่อน

      Use content streaming with child/descendant added and removing to detect when instances stream in and out to update the map this will allow you to reduce the amount of instances you have in your map th-cam.com/video/d8pqcfxqmek/w-d-xo.html

    • @thegameinglemon1072
      @thegameinglemon1072 2 หลายเดือนก่อน

      @5uphi Thanks for the reply. I was planning on using content streaming anyway, but it does seem inefficient to be cloning and destroying parts. I'll have to give it a try and see if it's negligible.

    • @5uphi
      @5uphi  2 หลายเดือนก่อน

      Another way is once you have finished the map take a screenshot just use that screenshot

  • @BeeSwarmTadpole
    @BeeSwarmTadpole 8 หลายเดือนก่อน +1

    The tuturial is amazing but im just stuck at 19:27 i can't get the chunks to update normally 😭😭

    • @BeeSwarmTadpole
      @BeeSwarmTadpole 8 หลายเดือนก่อน +1

      Ye ehm I think I'm quitting this idea it's a great video and I suppose it'll help others real good but I've been searching 40 min+ and still can't find what I've done wrong I have read the script over 3 times to check for any spelling mistakes, Upper/Lower Case and just about anything I just can't find it...

    • @BeeSwarmTadpole
      @BeeSwarmTadpole 8 หลายเดือนก่อน +1

      I can still see the viewport updating 🥲

    • @BeeSwarmTadpole
      @BeeSwarmTadpole 8 หลายเดือนก่อน +1

      So I rewrote the whole script and you can still see the viewportframe updating anyone know how to fix this? (Time stamp mentioned above)

    • @5uphi
      @5uphi  8 หลายเดือนก่อน +2

      It might be because content streaming is enabled so when the player enters the game the folder has not loaded yet so nothing is added to the folder
      You can use child added and child removed to detect when the things are added to the folder to add them to the viewport

  • @luketloop
    @luketloop ปีที่แล้ว +1

    The speed in which you type is incredible

    • @5uphi
      @5uphi  ปีที่แล้ว

      AutoHotKey

  • @alexandrvu7010
    @alexandrvu7010 8 หลายเดือนก่อน

    Marvelous work!!!

  • @h2iw-f1o
    @h2iw-f1o ปีที่แล้ว +1

    Everything works well but there is a issue
    i can only the bassplate in the map and nothing else

  • @infinity2394
    @infinity2394 2 ปีที่แล้ว

    YOOOOOOOOOOOOO THIS IS ACTUALLY INSANE

  • @Smurfis
    @Smurfis ปีที่แล้ว

    I’d like to incorporate a friend system for this and remove the ability to see the “Player2” as well as make it circular

    • @5uphi
      @5uphi  ปีที่แล้ว +1

      all of that is possible check out the discord for help

  • @akdnberkay
    @akdnberkay 2 ปีที่แล้ว +2

    How can I enlarge the map and see the whole map by pressing a button or tapping on it

    • @5uphi
      @5uphi  2 ปีที่แล้ว +1

      simply change the size of the outer frame

  • @superstorm4228
    @superstorm4228 ปีที่แล้ว

    Thanks for the tutorial. At 5:00 when you run the local script it loops all the objects in the Map folder and clones them into your viewport frame, but when I do it nothing happens because it runs so fast that it loops before any objects can be rendered into the game in the map folder. Why do I have this problem and you don't? Also is there a solution to this problem other than adding a simple wait before I run any of the local scripts code?

    • @5uphi
      @5uphi  ปีที่แล้ว

      You can use childadded to detect when instances get added

  • @devdeepy5665
    @devdeepy5665 2 ปีที่แล้ว +1

    Amazing!

  • @RagedCascade359
    @RagedCascade359 3 หลายเดือนก่อน +1

    where do you get the math for this bro? like do you learn this on your own or smth

    • @5uphi
      @5uphi  3 หลายเดือนก่อน +2

      Yup I discover the math on my own

    • @RagedCascade359
      @RagedCascade359 3 หลายเดือนก่อน +1

      @@5uphi how

    • @5uphi
      @5uphi  2 หลายเดือนก่อน +2

      When you have been playing with numbers for a long time your power over manipulating them increases
      So in short lots of practice

  • @HK_Martin
    @HK_Martin ปีที่แล้ว

    so i copied everything exactly, and for some reason when i walk, the image jumps instead of a smooth transition, and doesn't seem to align with my characters position at all times.
    i added different parts into the Map Folder but still same result.

    • @5uphi
      @5uphi  ปีที่แล้ว +1

      Something might be incorrect with your gui

    • @HK_Martin
      @HK_Martin ปีที่แล้ว

      ​@@5uphi i looked over the code many times, i checked the gui, i even changed every single thing in the gui and tried to see how it affected it and still nothing.
      Edit: whats even weirder is when i copy the minimap system into a different game it works
      Edit2: The issue happens when the parts are further away from the worlds Y axis. In Order to Fix this i just changed the workspace's Y Position

  • @alex342gwsturk8
    @alex342gwsturk8 ปีที่แล้ว +1

    i have a question, can viewport frames be on billboardgui and surfacegui or is it screengui only

    • @5uphi
      @5uphi  ปีที่แล้ว +1

      If I remember correctly it can

  • @bwah9481
    @bwah9481 ปีที่แล้ว

    Tip: Use a noise gate on your mic

    • @5uphi
      @5uphi  ปีที่แล้ว

      Mic problems have been fixed in more recent videos

  • @ImNotKriss
    @ImNotKriss 6 หลายเดือนก่อน

    how does this guy code so fast and smooth

    • @5uphi
      @5uphi  6 หลายเดือนก่อน

      AutoHotKey

  • @yeah7689
    @yeah7689 2 ปีที่แล้ว

    Can you make a Pistol with recoil and cool effects that damages a player? Also, I found your channel yesterday and I am so glad I did, I made a cool car thanks to you!

    • @5uphi
      @5uphi  2 ปีที่แล้ว +3

      i am trying to think of some good gun code but will most likely not be about the effects but how to make guns not exploitable

    • @root6132
      @root6132 2 ปีที่แล้ว

      @@5uphi that’s exactly what we need, making non exploitable weapon/gun system gotta be hella useful, amazing content keep it up ❤️🔥.

    • @yeah7689
      @yeah7689 2 ปีที่แล้ว

      @@5uphi I'm fine with that.

    • @SamLeroSberg
      @SamLeroSberg 2 ปีที่แล้ว

      Recoil basically just tween the camera's CFrame

  • @goreacraft
    @goreacraft 2 ปีที่แล้ว +1

    Thank you for the tutorial (i wish you made this a few months ago when i had to make my own minimap script and i am not willing to rewrite it now :P, was to much of a hassle ), but still got some nice ideas from this tutorial.
    I wonder if your minimap system works well with "SteamingEnabled"?

    • @5uphi
      @5uphi  2 ปีที่แล้ว +2

      The viewport updates as you move from chunk to chunk so if the parts have been streamed by the time you enter a chunk it should be in the mini map or you would need to force update the viewport when a new item gets added

  • @deactivated_.
    @deactivated_. 2 ปีที่แล้ว

    I'm really confused because of the first part of the localscript. I have a map with multiple folders inside to count for other uses, so does that not work?
    When I run my game, the viewport is not there at all. It is just a completely white screen on my minimap.

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      It's down to you to decide what parts get cloned into the viewportframe if it's completely white then it's most likely that your not cloning anything into the viewportframe so it's just a empty frame

    • @deactivated_.
      @deactivated_. 2 ปีที่แล้ว

      @@5uphi This makes sense, because of how you coded it, but I copied every instance underneath the "OldMap" folder (which is what i'm referring to as my map folder). Would it clone everything inside a child folder from "OldMap", such as a Folder inside called "Walls" or "Trees", as an example?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      if you use getchildren then it will only clone the children if you use getdescendants that it will get everything including things inside sub folders

    • @deactivated_.
      @deactivated_. 2 ปีที่แล้ว

      @@5uphi Alright, thanks. That's probably where I've gone wrong.

  • @absolute_zero982
    @absolute_zero982 2 ปีที่แล้ว

    That help alot thank you

  • @정준희-e1w
    @정준희-e1w 2 ปีที่แล้ว

    Hey do you know if there is a way to make a mini map with terrain?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Viewportframes can't render terrain you will have to create parts that emulate the terrain

  • @piano-dev
    @piano-dev 8 หลายเดือนก่อน +1

    cool

  • @LIVXXET
    @LIVXXET ปีที่แล้ว

    so im following your video and on my end my viewport is only displaying a white screen?

    • @5uphi
      @5uphi  ปีที่แล้ว

      Make sure to follow the video correctly

    • @LIVXXET
      @LIVXXET ปีที่แล้ว

      @@5uphi thank you

    • @LIVXXET
      @LIVXXET ปีที่แล้ว

      wait so when i re did it it doesnt send anything to the viewport frame

    • @5uphi
      @5uphi  ปีที่แล้ว

      This is mostly likely because content streaming is turned on by default now
      You need to use childadded to detect when a part streams in you can also use a model with streaming set to persistent I have a video on content streaming if you need more information

    • @LIVXXET
      @LIVXXET ปีที่แล้ว

      @@5uphi def would like that thank you

  • @zesuma
    @zesuma 2 ปีที่แล้ว

    Brilliant

  • @peskybird202
    @peskybird202 2 ปีที่แล้ว

    Question, would this work on natural terrain or does this only support part-made terrain?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Viewports are not able to render terrain

    • @peskybird202
      @peskybird202 2 ปีที่แล้ว

      @@5uphi gotcha, thanks.

    • @5uphi
      @5uphi  2 ปีที่แล้ว +1

      You could read the terrain voxels or raycast and use that to generate parts that looks like terrain but it won't be very good on performance

  • @Kitsune_Dev
    @Kitsune_Dev ปีที่แล้ว

    How can I make this work with terrain?

    • @5uphi
      @5uphi  ปีที่แล้ว

      Raycast to find the height of the terrain then place a part in the minimap to represent the terrain

  • @НастяФедорова-ь8ь
    @НастяФедорова-ь8ь 2 ปีที่แล้ว

    Thanks!

  • @karlson203
    @karlson203 ปีที่แล้ว

    do you know how to translate this into a surface gui?

    • @5uphi
      @5uphi  ปีที่แล้ว

      Simply place the viewport frame into a surface gui

  • @dextertheio2857
    @dextertheio2857 7 หลายเดือนก่อน

    how does this guy type so fast?

  • @uzidayo
    @uzidayo ปีที่แล้ว

    Why do we move the frame's position instead of the camera?

    • @5uphi
      @5uphi  ปีที่แล้ว

      Because when you move the camera the viewport has to render the texture again so if you have 100000s of parts in your viewport its more optimal to move the frames position
      but you don't have to do it this way if you like you could just move the camera

    • @uzidayo
      @uzidayo ปีที่แล้ว

      @@5uphi Ah, I thought so. So as long as we don't change anything in the viewport (such as the children/properties/cframes or whatever) the viewport will cache the texture instead of re-rendering every frame

    • @5uphi
      @5uphi  ปีที่แล้ว

      Correct

  • @Luckychew
    @Luckychew ปีที่แล้ว

    Hey i've done everything correct and it just doesn't work for some reason.

    • @5uphi
      @5uphi  ปีที่แล้ว

      Double check you must of made a mistake somewhere

    • @Luckychew
      @Luckychew ปีที่แล้ว

      @@5uphi i've checked multiple times. it just doesn't work (sorry for late response,forgot about this xD)

  • @jeanjoensuu8391
    @jeanjoensuu8391 2 ปีที่แล้ว

    Why map only move front left and back right?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      I did not quite understand the question

    • @SamLeroSberg
      @SamLeroSberg 2 ปีที่แล้ว

      @@5uphi He wants it to rotate on your perspective as well. You could do this by rotating the top down-view camera to be the same rotation as the player's Y orientation. Ofc this will look weird when your character is spinning

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Oh well clip descendants and rotating GUI does not work together so if you wanted to rotate the mini map you would have to update the camera every frame

  • @opm_a-ngo2903
    @opm_a-ngo2903 ปีที่แล้ว

    would this work with terrain ?

    • @5uphi
      @5uphi  ปีที่แล้ว

      You would have to use parts to represent the terrain

  • @ghostlytf2hvhking842
    @ghostlytf2hvhking842 5 หลายเดือนก่อน

    doesnt work can i have a copy of ur game with this script? :c

    • @5uphi
      @5uphi  5 หลายเดือนก่อน

      There is a copy in the discord server

    • @ghostlytf2hvhking842
      @ghostlytf2hvhking842 5 หลายเดือนก่อน

      @@5uphi thanks, u know how i could make it render meshparts and models?

    • @5uphi
      @5uphi  5 หลายเดือนก่อน

      Yes simply parent the meshpart or model into the viewport frame

    • @ghostlytf2hvhking842
      @ghostlytf2hvhking842 5 หลายเดือนก่อน

      @@5uphi one more question, why the minimap only renders until the limit of the baseplate?

    • @5uphi
      @5uphi  5 หลายเดือนก่อน

      I think the problem your having is with content streaming when you walk the server will stream to the client but your not adding them new streamed in parts into the viewportframe you will need to use childadded and childremove to detect when parts stream in and out

  • @xato8673
    @xato8673 2 ปีที่แล้ว

    tnx you

  • @parrot9148
    @parrot9148 2 ปีที่แล้ว

    Does it show client sided replications?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Yes but because the viewport only updates when you move from one chunk to the next chunk you would have to force the viewport to update when something changes so this optimised method works best for things that are anchored and are not moving but if you want to have moving parts it might be best to just have the viewport camera update every frame and not worry about the optimized chunk system I show in this video

  • @indoshonstudios1893
    @indoshonstudios1893 ปีที่แล้ว

    Don't wanna be that guy, but like... this just does not work anymore

    • @5uphi
      @5uphi  ปีที่แล้ว

      It does work :)

    • @indoshonstudios1893
      @indoshonstudios1893 ปีที่แล้ว

      @@5uphi You sure? When's the last time you tested it?

    • @5uphi
      @5uphi  ปีที่แล้ว

      if you share your code in discord we can help you fix it

    • @austincampbell1297
      @austincampbell1297 ปีที่แล้ว

      I was also having issues and I found that making the viewport frame 2 times as big as the frame helped solve it. Also be cautious about getting + and * mixed up. Those are the issues I had

  • @b5rke_
    @b5rke_ 2 ปีที่แล้ว

    Working for terrains?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      no you would have to generate lots of parts to represent the terrain

  • @_quite.essentiallyjay
    @_quite.essentiallyjay 2 ปีที่แล้ว

    damn, I thought I'd find one that could render terrain

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      Only way would be to create parts with raycasting to represent terrain

    • @_quite.essentiallyjay
      @_quite.essentiallyjay 2 ปีที่แล้ว

      @@5uphi hmm i never thought of that as a possibility before
      thanks for the idea

  • @akzholtosamaeva117
    @akzholtosamaeva117 2 ปีที่แล้ว

    😍😍😍😘😘😘

  • @mynamesisAldi
    @mynamesisAldi ปีที่แล้ว

    Bro you are should make a game in unity or unreal insteas of roblox studio

    • @5uphi
      @5uphi  ปีที่แล้ว +2

      I like Roblox and Lua is my favourite language but if I did use something else I would most likely try GODOT

  • @jtxdgamer455
    @jtxdgamer455 2 ปีที่แล้ว +1

    Hey man.
    I've been trying to write ur script so many times but it just dont wanna work.
    local frame = script.Parent
    local camera = workspace.CurrentCamera
    local viewPortFrame = frame.ViewportFrame
    for i, descendat in ipairs(workspace.Map:GetDescendants()) do
    if descendat:Isa("BasePart") == false then
    continue
    end
    local clone = descendat:Clone()
    clone.parent = viewPortFrame
    end
    local viewPortCamera = Instance.new("Camera")
    viewPortCamera.FieldOfView = 20
    viewPortFrame.CurrentCamera = viewPortCamera
    local offset = Vector3.new(0, 500, 0)
    camera:GetPropertyChangedSignal("Focus"):Connect(function()
    local cz = camera.Focus.Position.Z
    local cx = camera.Focus.Position.X
    local position = Vector3.new(cx, 0, cz)
    viewPortCamera.CFrame = CFrame.lookAt(position + offset, position -Vector3.zAxis)

    end)
    everything is right idk why its not working.
    could u please send me the whole script in text ?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      In the description of the video is a link to the discord channel

    • @thediamondbowtdb1633
      @thediamondbowtdb1633 ปีที่แล้ว

      @@5uphi Bruh where in the discord

  • @tohereknowswhen779
    @tohereknowswhen779 2 ปีที่แล้ว

    yoooo

    • @5uphi
      @5uphi  2 ปีที่แล้ว +1

      Yo

    • @tohereknowswhen779
      @tohereknowswhen779 2 ปีที่แล้ว

      @@5uphi id really like to learn coding but my inconsistency is against it.. can you give me some tips and proper mindset man? :(((
      should i take online courses?

    • @5uphi
      @5uphi  2 ปีที่แล้ว

      just do it!, I never took any courses

  • @g14n_
    @g14n_ ปีที่แล้ว

    29:29

  • @Andreiux
    @Andreiux 5 หลายเดือนก่อน +2

    local frame = script.Parent
    local camera = workspace.CurrentCamera
    local viewportFrame = frame.ViewportFrame
    for i, descendant in ipairs(workspace.MiniMap:GetDescendants()) do
    if descendant:IsA("BasePart") == false then continue end
    local clone = descendant:Clone()
    clone.Parent = viewportFrame
    end
    local chunkSize = 128
    local ChunkHalf = chunkSize / 2
    local offset = Vector3.new(0,500,0)
    local currentX, currentZ = math.huge, math.huge
    local viewportCamera = Instance.new("Camera")
    viewportCamera.FieldOfView = 28
    viewportFrame.CurrentCamera = viewportCamera
    local offset = Vector3.new(0, 500, 0)
    camera.GetPropertyChangeSignal("Focus"):Connect(function()
    local cx = camera.Focus.Position.X / chunkSize
    local cz = camera.Focus.Position.Z / chunkSize

    local chunkX = math.floor(cx)
    local chunkZ = math.floor(cz)

    local x = cx % 1
    local z = cz % 1

    if currentX ~= chunkX or currentZ ~= chunkZ then
    currentX, currentZ = chunkX, chunkZ
    local position = Vector3.new (chunkX * chunkSize + ChunkHalf, 0, chunkZ * chunkSize + ChunkHalf)
    viewportCamera.CFrame = CFrame.lookAt(position + offset, position, - Vector3.zAxis)
    end

    viewportFrame.Position = UDim2.new(1 - x, 0, 1 - z, 0)
    end)

    • @41Bobo
      @41Bobo 11 วันที่ผ่านมา +1

      thank you very much good sir but you missed at line 22. camera:GetProperty... not a dot its a double dot (event)

  • @BOB-hy5nz
    @BOB-hy5nz 9 หลายเดือนก่อน

    local frame = script.Parent
    local camera = workspace.CurrentCamera
    local viewportFrame = frame.ViewportFrame
    for i, descendant in inpairs(workspace.Map:GetDescendants()) do
    if descendant:IsA("BasePart") == false then continue end
    local clone = descedant:Clone()
    clone.Parent = viewportFrame
    end
    local viewportCamera = instance.new("Camera")
    viewportCamera.FieldOfView = 28
    viewportFrame.CurrentCamera = viewportCamera
    local offset = Vector3.new(0, 500, 0)
    camera.GetPropertyChangeSignal("Focus"):Connect(function()