ViewSizeChanged event request!



I’m TeaAndCopy. This feature request comes only from Webmotion. As he isn’t in the devforum, I said I would post his ideas for him. Please note I am only the messenger in this instance. Every useful piece of feedback will be sent directly to him.


I digress, this feature would look like this:


This event would fire when the client’s window size is changed.

Use Case

-- Local Script
game:GetService('UserInputService').ViewSizeChanged:connect(function(x, y)
   -- x, y would represent the new ViewSizeX and ViewSizeY (Absolute size of the screen in pixels)
   print('new ViewSizeX: ' .. x .. ', new ViewSizeY: ' .. y)
   -- This event could also be used to position scaled Gui objects, for example:
   local textlabel = script.Parent:FindFirstChild('TextLabel')
   textlabel.SizeConstraint = Enum.SizeConstraint.RelativeYY
   textlabel.Size =, 0, 0.8, 0)
   textlabel.Position =, -(textlabel.AbsoluteSize.X/2), 0.1, 0)
   -- The AbsoluteSize of the object will be changed when the window is resized, so we need to position the object again.

Without the event above, the TextLabel would remain at the same position as before when the window is resized.


However, there are other ways to re-position the object, for example using this:

textlabel.Position =, -(textlabel.AbsoluteSize.X/2), 0.1, 0) -- Using this in a while loop

You could also make this work using scale on a XY Constraint which would mean you can position them using scale.
However if you’re using YY or XX SizeConstraints, a script would be needed to position the object directly in the centre of the X or Y axis, depending on which constraint you’re using.

Please post your thoughts & opinions below as myself and Webmotion would love to hear what you think of this idea.

-Tea & Web


So basically

	print("New size:", workspace.CurrentCamera.ViewportSize)

works with minimizing/maximizing, snapping the window etc., as I just tested it.