OS and Device Detection Module

“DeviceService”

Device and Operating System Detection can be a pain, so i decided to make this abstraction layer so all my pain goes away. Huge thanks to @ChatGGPT for the OS detection function

Link to the resources

Device Service Resources

Setup

local engine = {DeviceService = require(game.ReplicatedStorage.DeviceService), _Enum = require(game.ReplicatedStorage._Enum)}

This is how you call it

Features

Events

.CheckDeviceType
Fires when you Emit, returns a device Enum from the weird custom Enum i made
.CheckPlatformType
Fires when you Emit as well, returns a Platform Enum eg(Windows,Android)

Function

:IsInGroup(device,groupEnum)

Enumate
or _Enum
It uses bitflag based constants for device types, groups or platforms. also includes a name table for easy lookup
This is the table for DeviceType

Enumate.DeviceType = {
Phone = 0x01,
Tablet = 0x02,
SmallPhone = 0x04,
Console = 0x08,
Computer = 0x10,
Unknown = 0xFFFF,
Potato = 0x40,
Name = {
[0x01] = “Phone”,
[0x02] = “Tablet”,
[0x04] = “SmallPhone”,
[0x08] = “Console”,
[0x10] = “Computer”,
[0x40] = “Potato”,
[0xFFFF] = “Unknown”,
}
}

Yes there is a “Name” table to make look ups easier, use Name[0x00] to find the string of the Enum

Sample

local engine = {DeviceService = require(game.ReplicatedStorage.DeviceService), _Enum = require(game.ReplicatedStorage._Enum)}

engine.DeviceService.CheckDeviceType:Connect(function(device)
if engine.DeviceService:IsInGroup(device, engine._Enum.DeviceGroup.Mobile) then
print(“Phone?”)
if plrgui.TouchGui then
else
print(“bad”)
end
end
print(engine._Enum.DeviceType.Name[device])
end)

engine.DeviceService.CheckDevicePlatform:Connect(function(platform)
if platform == engine._Enum.Platform.Windows then
print(“Windows”)
end
end)
engine.DeviceService:Emit()

Why did I make this?
because device detection is very essential, and its a hassle to do so, so this is why I made this abstraction layer to make it easier to do so! Tweak, Fork, Rewrite if you want.

21 Likes

thank you very OP now i can kick those nasty exploiters that use android emulators with linux (im being sarcastic idc about kicking them lol)

7 Likes


Look at that.

1 Like

Seems like we can’t use GetDeviceInfo in regular scripts? Why bring it up?

1 Like

Thought it was weird why such a function would be under CaptureService, a service specifically designed for capturing screenshots and screen recordings

1 Like

Does this module detect Sober (aka. Linux users)? I want to kick them out of my game on join

3 Likes

Are you genuinely serious?

6 Likes

Yes, I am serious. I don’t want people on Sober playing.

2 Likes

Genuine question, why is that?

3 Likes

the sheer aura of linux users scare tf out of this guy, clearly

and theres no way to detect sober really so

4 Likes

Check if the client is Android and if Touch is disabled

And for Grapejuice, probably just check if the client is Windows and check for Unicode character E0FF (which is Ubuntu Logo)

1 Like

Please do share your detection. I too would love to remove Linux players from our experiences!

android vs apple war… now its windows vs linux war i suppose? noooo, stop these wars!

one of the ways to detect linux, u can check if the version has “2.”, no AccelerometerEnabled and has mouse/keyboard.

Theres this module that was created some time ago (before this topic/similar i “updated it recently” to remove comments) which has detections for stuff https://create.roblox.com/store/asset/108086850347427/OSDetector

Based off my recent anti-cheat detection logs:
Version: 2.681.805 (Android/iOS): 4,116
Version: 0.683.1.6830778: 225

2 Likes

Thanks for making this module, I integrated it in my game as an alternative detection vector and I haven’t had another complaint about a Linux user being in-game so it really works well at detecting them.

Genuine question as a regular Linux user that just plays Roblox normally - Why do you want Linux users out of the game anyway? In my experience, no casual player would actually notice I’m a Sober user, and I (and other Linux users) just want to play in peace.

The way I understand it is that you think Linux is being used as a platform to run exploits, and you think it wouldn’t hurt to ban these players since they’re only 2% of the population.

2 Likes

I didnt expect this to get so big, ill release a patch soon

NOTE: The events cannot be nested i suggest using

local device
local platform

local function Try()
if device and platform then

end
end

engine.DeviceService.CheckDeviceType:Connect(function(device)
device = device
Try()
end)

engine.DeviceService.CheckDevicePlatform:Connect(function(platform)
platform = platform
Try()
end)

People use Android phones running Linux to AFK farm and exploit games. The easiest and laziest way to completely avoid this is to simply remove all Sober Linux users.

1 Like

well i know which developer’s games and projects to avoid!

1 Like

Will this detect linux distros?