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

My gui is not enabling on tablet devices, why?

I made a script to check if a player is on mobile, pc or tablet. The Pc works fine, so does the mobile, but the tablet does not.

My script:

local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
 
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled then
    if not GuiService:IsTenFootInterface() then
        script.Parent.PcandtabletMenu.Enabled = false
    end
else
    script.Parent.PcandtabletMenu.Enabled = true
end

It does not show on tablet devices but does on pc.

1 comment

0

Is there a tablet simulator built in into roblox maybe you can try that

1 answer

✓ Accepted answer

There is No way to find if a person is on tablet, mobile and tablet would find the same thing. Try this:

local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local IS_CONSOLE = GuiService:IsTenFootInterface() -- check if the screen is a ten-foot interface, only true if device is console
local IS_PC = UserInputService.MouseEnabled and UserInputService.KeyboardEnabled and not IS_CONSOLE -- check if the mouse enabled, keyboard enabled, and not a console, most commonly a pc, gonna have to be!
local IS_MOBILE = UserInputService.TouchEnabled and not IS_CONSOLE -- check if touch is enabled and not device console. Most commonly Mobile/Tablet

Edit this code to your specifications. If this helps, please mark this as a solution. That's it! Metatable out!

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