Title says it all. I really have no idea what to try. Thanks in advance.
✓ ANSWER ACCEPTED
How would I get the current size of my screen (in pixels)?
2 answers
✓ Accepted answer
Using the PlayerMouse Object from a GetMouse method of a Player:
--LocalScript
local mouse = game.Players.LocalPlayer:GetMouse()
local screenSize = Vector2.new(mouse.ViewSizeX, mouse.ViewSizeY)
Although this won't be accurate if the user resizes their screen, so:
--LocalScript
local mouse = game.Players.LocalPlayer:GetMouse()
local screenSize = Vector2.new(mouse.ViewSizeX, mouse.ViewSizeY)
game:GetService("RunService").RenderStepped:connect(function()
local newSize = Vector2.new(mouse.ViewSizeX, mouse.ViewSizeY)
if newSize ~= screenSize then
screenSize = newSize
end
end)
You could also use a ScreenGui. They have a readonly variable called AbsoluteSize which is in pixels and is the size of the window, not including the border.
This discussion is preserved as it was. New answers, comments, and votes are closed.
