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

How do I detect a mobile device or a touch device?

I want to set it out like this;

if IsUsingMobileDevice == true then
--Set a boolean value to true
elseif IsUsingMobileDevice == false then
--Set a boolean value to false
end

All feedback is appreciated, Thanks! -Oaktin

1 comment

0

+1 I would like to know this as well

1 answer

I have found the answer or at least an alternative answer. Here is the code I will use;

if game:GetService("UserInputService").TouchEnabled == true then
    --Sets boolean value to true
elseif game:GetService("UserInputService").TouchEnabled == false then
    --Sets boolean value to false
end

3 comments

0

Hi Oatkin, does this distinguish whether it is a phone or tablet?

0

No it does not sadly, I am trying to find a function for that.

0

Thanks, this will help me out a lot in the future. 1+

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