Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Oaktin 35
9 years ago

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

0
+1 I would like to know this as well Im_Kritz 334 — 9y

1 answer

Log in to vote
1
Answered by
Oaktin 35
9 years ago

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

0
Hi Oatkin, does this distinguish whether it is a phone or tablet? fahmisack123 385 — 9y
0
No it does not sadly, I am trying to find a function for that. Oaktin 35 — 9y
0
Thanks, this will help me out a lot in the future. 1+ ChemicalHex 979 — 9y
Ad

Answer this question