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

Get the player's screen size?

Asked by 8 years ago

I know getting the AbsoluteSize of a ScreenGui inside the player's PlayerGui can achieve this, but what if you need to get the size of the screen, without relying on a GUI's AbsoluteSize property? Is there any other way to do this?

0
I don't think so, as of now xuefei123 214 — 8y

1 answer

Log in to vote
1
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

You can get the screen size through the ViewSizeX and ViewSizeY properties of the player's mouse.

Here's an example:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()
    print(mouse.ViewSizeX .."x" ..mouse.ViewSizeY)
end)

Assuming the size of the game window is 800x600, this would print:

800x600

Keep in mind, this represents the size of the game window, not the necessarily the full screen. Hope this helped.

Ad

Answer this question