Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make different GUIs for different devices?

I am making a GUI but it works better with a mouse than a touch screen device. How do I make a separate GUI for other devices? It might be confusing so an example of this is a game called "Miners Haven", when I play it on my tablet the GUI is different from the GUI when I play on my computer. I want to make a GUI that works better with mobile devices, and a separate one that works better with desktop users.

1 answer

✓ Accepted answer

To get what device a user is on, you can simply use UserInputService like so.

local UIS = game:GetService('UserInputService')
if UIS.MouseEnabled == true then --All computer users are forced to have a mouse.
	print('The user is on a computer!')
elseif UIS.TouchEnabled == true then --For mobile.
	print('The user is on mobile!')
elseif UIS.VREnabled == true then --For virtual reality (maybe roblox will be coming out on this soon, never seen roblox on VR before.)
	print('The user is using a virtual reality headset!')
else --Otherwise, the user is on XBOX.
	print('The user is on XBOX.')
end

and then you should script different GUIs for the different devices. More on UserInputService is here. Hope this helps!

1 comment

0

Roblox has had VR for a while now.

This discussion is preserved as it was. New answers, comments, and votes are closed.