Screen resolution

Hi, thanks for coming here.

So to keep this simple, I want to move a GUI frame based on the players resolution screen. So kinda like

If (playerscreen was this resolution) then
–move the frame to the right (I know that so I only need the player resolution)

Thanks, Axlas.

2 Likes

Try workspace.Camera.ViewportSize.

1 Like

Yeah that’s what I read on the internet but how do I use that into a IF statement.

1 Like

Try

if workspace.Camera.ViewportSize == Vector2.new(1079, 388) then
	print("Hello")
else
	print("Bye")
end

Screenshot 2021-10-04 at 22.07.20

ummmmm

1 Like

Try printing your view port size of your screen and put it in there then it’ll work

all the screen resolutions post as 1,1

1 Like

Is it working how you want it?

1 Like

No, because let say that we had a Laptop screen posting as screen resolution 1,1 and HD resolution screen as 1,1 then there is no difference and I would like it for example move further the GUI frame for laptop screens than HD resolution screens but I can’t add any if statements if they both display as 1,1.

If that makes sense.

Your issue is likely that you are checking the viewport size from a Server Script instead of a LocalScript.

That property referring to the “Camera” in workspace from the server would just show the default values, since that camera is not assigned to a player.

That property referring to the “Camera” in workspace from the prospective of the client, such as through a LocalScript, will have the properties of the LocalPlayer.

1 Like

Also, if you’re just trying to distinguish between PC users and tablet/phone users, you can just use TouchEnabled

1 Like

Nothing shows up if I put it into a local script.

I’m trying to distinguish the different PC based screen resolutions.

Nvm, I put the script into StarterGui and it works, thanks!