Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function DetectPlatform()
- -- TenFootInterface was made exclusively for XBOX One, so easy to eliminate this one
- if game.GuiService:IsTenFootInterface() then return "Console" end
- local function inferMobileType()
- if workspace.CurrentCamera.ViewportSize.Y > 600 then
- return "Tablet"
- else
- return "Phone"
- end
- end
- local uis = game:GetService("UserInputService")
- -- Assuming that PC's would not have these kinds of features, so figure out which type of Mobile it is
- if uis.AccelerometerEnabled or uis.GyroscopeEnabled then return inferMobileType() end
- -- So still remaining are PC's and Mobile devices without the above features, We'll use the presence of a keyboard/mouse to distinguish the two
- if uis.KeyboardEnabled or uis.MouseEnabled then return "PC" end
- -- Finally we assume the device has to be mobile
- return inferMobileType()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement