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

How do I make my Gui automattic fit the Game-Screen?

Asked by 7 years ago
Edited 7 years ago

I'm Working on my own MusicGui & now the only thing I need to do is have the Position right. I have the button to the Music Gui at the Bottom right cornor just before it goes out of the screen. But you can only see them or I can only see them if i'm in F11 which makes the site / game filling out the whole pc or tv screen.

How do I make the Button automattic fit the game-Screen & not the Pc screen? Not all use F11 when playing.

Button Position: {0, 950},{0, 800}

The Button script: (Normal)

button = script.Parent
MusicScript = game.Workspace.MusicPlayer -- Where the Music plays (Nothing about size)
open=true

--[[
    If a song is deleted then delete it in here to. or set "--" in front of it.
    If you have added a new one. Then just type in "MusicScript.SongName.Volume"
    Remember that you need to add in both = 1 & at = 0
    SongName change that to the name of what you called the Sound.
    It should be easy
--]]


button.MouseButton1Click:Connect(function()
    if not open then
        open=true
        button.Text = "Music: On"
        MusicScript.Flight.Volume = 1
        MusicScript.Nova.Volume = 1
        MusicScript.FatRatUnity.Volume = 1
        MusicScript.OMFGHello.Volume = 1
        MusicScript.Starboy.Volume = 1
        MusicScript.TheFatRatMondoy.Volume = 1
        MusicScript.TobuCandyland.Volume = 1
    else
        open=false
        button.Text = "Music: Off"
        MusicScript.Flight.Volume = 0
        MusicScript.Nova.Volume = 0
        MusicScript.FatRatUnity.Volume = 0
        MusicScript.OMFGHello.Volume = 0
        MusicScript.Starboy.Volume = 0
        MusicScript.TheFatRatMondoy.Volume = 0
        MusicScript.TobuCandyland.Volume = 0
    end
end)

2 answers

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

{scale.x, offset.x}, {scale.y, offset.y}

That is the format for the button position. When you change the scale position, it moves the GUI based on the screen size.

So, {0.5, 0}, {0.5, 0} would move the GUI 50% down and 50% right of of the players screen. This means that the top left corner of the GUI would be located directly in the center of the screen.

When you change the offset, it moves the GUI based on the pixels.

So, in your case, {0, 950}, {0, 800} would move the GUI 950 pixels to the right and 800 pixels down. Therefore, when you are playing with a screen size of only 600px by 800px, your GUI would be located outside of the boundaries of the screen.

I recommend that you change the position to something like {0.8, 0}, {0.8, 0} and make your GUI size based on scales as well. Also, you can even make your GUI scale {1, 0}, {1, 0}, making it go to the bottom right of your screen and changing the size of your GUI to a negative scale like {-0.2,0}, {-0.3, 0} so that it will 'pop out' from the bottom right corner.These are all values that I made up on the spot, so just change these values to something that fits your game.

0
You made not only my Button. But you made all of my Guis. And some Animation may be changed too! Thx a lot! MineJulRBX 52 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Use a GUI creator plugin. Most of those automatically fix aspect ratio.

Answer this question