I need a way to detect if a player is on computer or on mobile.
Now obviously i can do this using UserInputService,
if uis.TouchEnabled then
--print("Mobile")
elseif uis.KeyboardEnabled or uis.MouseEnabled then
--print("Computer")
end
however it is possible to connect a keyboard and a mouse to a phone, and some computers do have touchscreen which would mean that a computer could get detected as a phone now in my case I am using this to change the gui around and if a computer gets detected as phone the gui just will not look good.
So is there a good way of detecting what kind of a device the player is using?
You can use GetLastInputType() method and LastInputTypeChanged event to know the last used input and then enable the visibility of the buttons depending on the input
It’s not really about visibility it’s about size, whenever I make a gui button for a computer its how I want it to be but then I change to mobile and it’s just too big so let’s say the keyboard would be the last input but the player is on a phone, the buttons would just be too big and cover up most of the screen.
You must be using Scale Size/Position Property instead of Offset, it automatically set the size/position according to the screen size, this will be a faster solution, AutoScale Plugin will do that for you, if you
have too many GUIs.