CitrusPie
(CitrusPie)
October 14, 2020, 2:57pm
#1
Hello there! I’m trying to make the game print the screen size on the console.
I’ve tried workspace.CurrentCamera.ViewportSize but everytime it shows 1,1 on the console.
Am I doing something wrong? Thanks.
P.S: If you could send some tutorials on how to detect the player’s screen size, I’d be really happy.
1 Like
Ocipa
(Ocipa)
October 14, 2020, 2:59pm
#2
local mouse = player:GetMouse()
x = mouse.ViewSizeX
y = mouse.ViewSizeY
5 Likes
CitrusPie
(CitrusPie)
October 14, 2020, 3:01pm
#3
Thanks! But where should I put that script? Should it be a Script or LocalScript?
1 Like
Ocipa
(Ocipa)
October 14, 2020, 3:02pm
#4
it needs to be a local script
local player = game.Players.LcoalPlayer
local mouse = player:GetMouse()
x = mouse.ViewSizeX
y = mouse.ViewSizeY
9 Likes
CitrusPie
(CitrusPie)
October 14, 2020, 3:02pm
#5
Where should I put it? In the workspace? Or any ScreenGUI?
1 Like
Ocipa
(Ocipa)
October 14, 2020, 3:03pm
#6
oh, you can put it in StarterPlayer.PlayerScripts, or you can put it inside of your gui.
2 Likes
CitrusPie
(CitrusPie)
October 14, 2020, 3:05pm
#7
Thank you! I’ll try it.
Oh my god! Oh my god! It works. Thank you sooo much!
Anygrybirdcharacter, you can still respond.
CitrusPie
(CitrusPie)
October 14, 2020, 3:07pm
#9
Ah, no worries! I already did. Thanks!
And a little PSA: Make sure that you add 73 to the value of the Y to get the actual size.
3 Likes
that is only if you have GuiInset enabled. 73 is the amount of pixels on your specific screen that the UI inset takes up but on everyone’s screen it is different.
3 Likes