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

GUI scale interference when game is minimized?

Asked by 8 years ago

Information

Apparently when you minimize a ROBLOX game client on an OS of windows 7 or earlier, it also interferes with the size of all scaled GUIs in-game (windows 8-10, on the other hand, does not). This means if you have a frame with the dimensions of {1,0} , {1,0} in size, when you minimize your game, it will be scaled down to nothing (i.e, having an AbsoluteSize of 0,0).

The problem

I have a chat system, where I rely on this section of code to get the space between the speaker label, and the message label:

-- And no, I'm not adding a wait(). That would take forever for messages to send.
while Label2.TextBounds.X < Label1.TextBounds.X do
    AppendText(Label2,' '); -- Adds a space to the text of Label2
end;

Every time a chat message is received by a player, this code must execute to find the length between the speaker label, and the message label so it can have a multi-line text effect (As seen here: http://prntscr.com/a9q72d)

There's no problem with this method when in-game. The PROBLEM is when you minimize your game client (on an OS of win7 or earlier), and for example, someone says something in chat while your game is minimized.

At this point, the while loop is just going to crash your client, because the scaled chat frame is now set to an AbsoluteSize of 0,0 (thanks to the windows OS 7- method of minimizing your screen), and it screws up the TextBounds property of the text labels.

Solution?

I know this was an odd question, but if anyone has a solution to this, or even an alternative method, I'd really appreciate it.

3 answers

Log in to vote
6
Answered by
evaera 8028 Trusted Badge of Merit Snack Break Game Jam Winner Moderation Voter Administrator Community Moderator Super Administrator
7 years ago

this is a test yo

Ad
Log in to vote
1
Answered by 8 years ago

Well, that's an interesting problem. TextBounds is sometimes finicky with ROBLOX. You could add a check for dimensions of 0, and handle it explicitly, or you could try increasing the size of all your GUIs by 1 (offset) in each dimension, to ensure there is always some size. I'm not entirely certain how either of these would work.

Another option would be to make a table of the width of every character and calculate it yourself without relying on TextBounds, but that would be a real pain.

0
Yeah I started to strongly consider that, but I actually thought of a better way, which would be just queuing the received chats while the player's screen is minimized, then loading them upon opening again. Thanks for your input though. ScriptGuider 5640 — 8y
Log in to vote
-3
Answered by
Myaxp 3
8 years ago

Who told you that using a win7 os or earlier would crash the game using a > while loop...

Let's be honest here: I still use windows 7 (even if win8.1 and win10 are out) and no matter how many times I minimize my screen the game still runs in the background. So what you're saying is that for windows 7, the game crashes due to a while true loop while the client's game is minimized...

Honestly that is a first that I heard that considering how much I make things with GUIs.

I know you said I'm not adding a wait() but really... it won't take forever for messages to send. Not unless you're doing wait(10). Just use "wait()"

Answer this question