Hello, I’ve been trying to develop a game for some time now and I’m going to begin work on a brightness calibration setting for the game. The only issue is, I’d like to datastore it. But I’d like to save it per device rather than per player. Is there any way to identify a device? I can’t seem to find info on this anywhere, help is appreciated.
EDIT: For some reason, nobody really understood what I meant. Apologies my wording wasn’t the best. But I’m not talking about console/mobile/pc I’m talking about having multiple PCs and other misc devices.
local UIS = game:GetService("UserInputService")
if (UIS.TouchEnabled) then
-- Mobile Device
else (UIS.KeyboardEnabled and UIS.MouseEnabled) then
-- Desktop
else (UIS.GamepadEnabled) then
-- Console
end
This is great except this is limited to CoreScripts. Using this in any other script will just throw an error. Read the very short API document here. What @Xueify is the only method to guess what device a player is using. This can still tend to work out well but since some laptops do have touch screens, some tablet and phone players use controller or keyboards, etc their is issues with identifying what the device really is. So this method can sometimes only be guessing what the device is.
To answer in short OP, the answer is no. For ROBLOX game to have the capabilities to read identifying device information would be insanely dangerous. I’d recommend just saving it per player, worst case you can save it per player per device (each player would have a console, mobile, and pc save), but past that I can’t imagine it being possible.
Well its a solution nonetheless. Obviously some laptops would have touchscreen, same for some desktops. There are other ways around this; but for this use-case its hard to determine if they’re actually using a different device- what if they connected their controller to their computer, now the game thinks its a console. I think saving settings per device is unnecessary just because what is the chance they play on two different devices in the first place.
You can state with 100% certainty whether a player is on console or not using GuiService:IsTenFootInterface, however outside of that I would agree it is a guessing game.
My systems only rely on client detection for things like UIs moving out of the way, where-as everything else is created universally compatible, however I will restate that I don’t think this is what OP means when he says “saving to a device”.
He wants to save a setting for a player for a specific device; i.e mobile, console, desktop. I don’t think he wanted the exact device information like the make and model number, but we’re all speculating here.