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

Is there a way to make a Viewport Frame item go smaller/bigger with the size of screen?

Asked by
IDKBlox 349 Moderation Voter
5 years ago

Basically just like the guis. I realize my screen may be a bit smaller/bigger than other players, and I just realized using the ViewportFrame the Item are a bit too big in player vs studio.

Thanks

0
Use scale instead of offset for the size of it. if that doesnt work, change the cameras fov depending on ScreenGui.AbsoluteSize. X or Y or both RubenKan 3615 — 5y
0
Yeah, I'm already using scale lol, I'm talking about the item within the Viewport frame, Seems If I don't find a better solution, i'll go with the fov depending on the absolute size lol Thanks! IDKBlox 349 — 5y
0
@IDK, ok I just read your comment, seems the site doesn't want to send me notifications for some reason... Anyway, I'll edit my answer to accommodate as soon as I get some feedback: Do you know how Viewport Frames work? Are you making the image for the Frame while in-game or are you pre-setting them in studio? SerpentineKing 3885 — 5y
0
I'm not getting any notifications either, that's the reasoning for the late response.. anyways, I'm having the script create the model, upon the game starting for the player... lol if that makes sense IDKBlox 349 — 5y
0
and yay and nay, i'm figuring Viewport frames out as I go lol IDKBlox 349 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Intro

When placed ancestrally inside of a Gui (Screen / Billboard / Surface), ViewportFrames have essentially the exact same properties as most other GuiObjects.

This being said, there are two properties and subcategories which you should be familiar with when making them compatible with all devices.

General Definitions

Position and Size are properties of the ViewPortFrame which determine the location of the frame and its size in relation to its parent or the actual window size itself. Both of these properties use UDim2 as measurements.

Each UDim2 is made up of an X and a Y component, which are separated as tables: ex. {0, 0}, {0, 0} where the first table is the X-Axis UDim (width) and the second table is the Y-Axis UDim (height)

Each of these UDims are comprised of a Scale Value and an Offset Value.

The first value is the Scale, which is the size of the GuiObject relative to its parent. To fit within the its parent, this should be set to a number that is between 0 and 1

The second value is the Offset, which is the size of the GuiObject relative to the Window Size in Pixels, meaning it is most compatible with Computer Screens.

Solution

If you want your game to have Guis that are easily visible the same way for all devices and players, you should have all of your GuiObjects using only Scale Values Ex. {1, 0}, {1, 0} and not {0.5, 300}, {0.5, 300}

0
I appreciate the huge explanation on how guis work with udims, honestly I may reference a few people back to this later on. But this is not what I was trying to ask; (Sorry for not clarifying well) I'm talking about the Item within the ViewportFrame. How could I get it to be the same size for all screen sizes? Is there something I can do with it gui related? or would I have to Change the size? IDKBlox 349 — 5y
0
Scale is not 0~1 at all. scale is 0~inf. This is the whole point of what scale is. User#5423 17 — 5y
Ad

Answer this question