Making screen Gui size and position proportional to the device the player is on

How do I make it so that the screen gui size and position is proportional to the device the player is one? I have tryed the Autoscale lite addon and the video and I just can’t seem to do it. ScoreboardScreenGui - Roblox Am formatting it wrong?


2 Likes

I would set custom sizes by making a script that uses UIS (UserInputServer) to see if they are on computer or mobile, then if its on mobile then the script would set the UI size to something and if its on computer it would do nothing (suggest using this: --On PC no need to do anything )

1 Like

Could you give pseudo code of what you mean by that

Here is what the code could look like :coefficients:

local UIS = game:GetService("UserInputService") -- get User Input Service

if UIS.KeyboardEnabled then -- main fuction
	print("User is using a computer! No need to scale!")
elseif UIS.TouchEnabled then -- Mobile
	script.Parent.TextLabel.Size = UDim2.new(0,500,0,200) -- Change this, this is an example of what it could be.
	print("User On Mobil!e")
elseif UIS.VREnabled then -- If in VR or somthing, only use if ur game is VR eles it can lag
	script.Parent.TextLabel.Size = UDim2.new(0,400,0,300) -- Change this, this is an example of what it could be.
	print("User using a VR headset!")
else -- finaly if it is somthing eles, Gamepad i think
	script.Parent.TextLabel.Size = UDim2.new(0,500,0,300) -- Change this, this is an example of what it could be.
	print("User using a gamepad i think!")
end ```
1 Like

thankyou very much! Even better than pseudo code! and thankyou for putting comments!!!

1 Like