GUI for Mobile Players

Hello, I’ve recently noticed, that my Progress GUI can only be accessed by Pc Players, since you open it while you hold Q. I wanted to know if its possible that you detect the Players device so mobile players get the Gui, but that they can click a button to see that. But i dont want that button to be visible for pc players.
Is something like that possible?

3 Likes

This can be found through simply searching the wiki or the Devforum , but One way you can do this is by using the UserInputService:

(this, isn’t a perfect solution, because as far as i know there isn’t any way to directly/100% accurately detect a player’s device, at least while using normal scripts (non-core scripts) )

local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UserInputService.TouchEnabled and not (UserInputService.KeyboardEnabled and UserInputService.GamepadEnabled and GuiService:IsTenFootInterface())  then
--player is using a mobile device 
else if UserInputService.KeyboardEnabled then
-----player is on Pc (or a Pc emulator)
     end
end

this particular example can be found here:
How to detect if Player is using a Phone? - #4 by buildthomas

16 Likes

Thank you so much man, sorry for the late reply. Its fixed :))

1 Like

Few questions

This works for iPad?
What type of script?
Where do you put the script?

That code will work for any device that accepts touch input. Place it in a local script under StarterPlayerScripts.