OS Type Detection

I want to use a custom hacky trick I made to make player think game is crashed so im suggesting if there is a way to detect difference between computers, I have tried to detect from memory usage but it wasn’t so success at all. MacOS uses a bit more stable memory usage but it can be changed for your game and every device including mobile that has +200 MB memory usage will count as MacOS, please help me by showing a way. Any helps would be appriciated

2 Likes

You can’t detect what OS a player is in, doing that by memory usage is terribly inefficient and ineffective, and there won’t be any problems for false positives to come up.

1 Like

Just giving up? I blieve there is a way but how.

2 Likes

Unfortunately, there is no way.

You can check their input protocol with GetLastInputType

 
local lastInput = game:GetService("UserInputService"):GetLastInputType()
 
if lastInput == Enum.UserInputType.TYPE_MOUSEMOVEMENT then
	print("windows/mac")
elseif lastInput == Enum.UserInputType.TYPE_TOUCH then
  print("iphone/android")
elseif lastInput == Enum.UserInputType.TYPE_GAMEPAD1 then
  print("xbox")
end

Unfortunatelly that code is not reliable for a couple of reasons:

  1. Computers with touchable screens exist.
  2. People can connect gamepads to computers.
  3. OP is asking how to detect what operating system is player playing on, not the platform.
1 Like

There is a problem also that I want to detect OS not device type.

Can you specify, what you’re trying to accomplish#

I think if you can explain what you mean by this we can help you little better finding a different solution, since OS detection is currently very hacky and i wouldn’t recommend it.

I want to detect the current OS player is on like detecting if its windows or MacOS etc…

Sorry! but that currently is not possible, this is because Roblox runs on Lua by which when I say Lua, it isn’t the traditional Lua, meaning its modified for networking and security purposes. If a hacker were to find out the operating system of a client then this would make their work easier because they would know the exploitation vulnerabilities of that specific OS. I may be wrong, but its the reason why you wouldn’t have OS-level access to the clients system.

I recommend you find another viable option…

Although, whatever trying to use the OS detection for, from experience I believe most players are on Windows, with a good number of player on Android/IOS with only a minority on other operating systems like MacOS and Unix, etc… Keep in mind most of Roblox’s demographic are children, popularly children prefer a Window’s laptop and Apple handhelds :confused:

Exactly. If this version of Lua could access OS properties, like regular Lua, people can easily create viruses. Also, roblox doesn’t have access to administrator properties on windows.

1 Like

I don’t like bringing up old posts, especially when this is from over 3 years ago. However, I just stumbled upon something in GuiService (although deprecated)

This boolean detects if the OS you are using is Windows:

which is useful because although it is deprecated, if it returns true, the player is on windows, if false, you can check if the player is on a PC or not and assume the player is using MacOS (although a bit hacky and is rather just an assumption, especially if the player is using Linux for example.)

3 Likes