Detect player's platform (Mobile, Console) via ServerSide script?

Hey all, as the title says, I want to detect what type of device a player is using with a serverside.

I want to make an AntiExploit but I want to ignore players with platforms that cannot run or execute exploits.

I have tried using all sorts of game services but unfortunately they all are local.

I am looking for a hacky way to ensure a player is either on a mobile or a console…

1 Like

I would just have it so is scans all players, not caring about there platform, because, if you do it from the client, is a exploiter unplugs there mouse and keyboard, and has a touch screen, then it would said be a mobile device.

And, I don’t think there is any way to find out a players platform on the server.

3 Likes

That is a valid point that I did not consider, thank you.

1 Like

Exploiters can change their platform through a script so… Don’t ignore them.

1 Like

I just wrote up a system for this which I believe works fairly well.

--LOCAL

local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("RemoteEvent")

local userInput = game:GetService("UserInputService")

local hasMouse = userInput.MouseEnabled --Mouse.
local hasKeyboard = userInput.KeyboardEnabled --Keyboard.
local hasTouchscreen = userInput.TouchEnabled --Touchscreen.
local hasGamepad = userInput.GamepadEnabled --Gamepad.

remote:FireServer(hasMouse, hasKeyboard, hasTouchscreen, hasGamepad)
--SERVER

local replicated = game:GetService("ReplicatedStorage")
local remote = replicated.RemoteEvent
local players = game:GetService("Players")

local playerControls = {}

local function onPlayerAdded(player)
	task.delay(10, function() --Change 10 if necessary.
		if not playerControls[player] then
			player:Kick("No data.")
		end
	end)
end

local function onPlayerRemoving(player)
	playerControls[player] = nil
end

local function onRemoteFired(player, mouse, keyboard, touchscreen, gamepad)
	if type(mouse) ~= "boolean" or type(keyboard) ~= "boolean" or type(touchscreen) ~= "boolean" or type(gamepad) ~= "boolean" then
		player:Kick("Malformed data.")
	end
	
	playerControls[player] = {["mouse"] = mouse, ["keyboard"] = keyboard, ["touchscreen"] = touchscreen, ["gamepad"] = gamepad}
	print(player.Name, mouse, keyboard, touchscreen, gamepad)
end

players.PlayerAdded:Connect(onPlayerAdded)
players.PlayerRemoving:Connect(onPlayerRemoving)
remote.OnServerEvent:Connect(onRemoteFired)

Sanity checks are performed on the server to ensure data sent from the client is valid, if any data is invalid the player belonging to that client is kicked. Additionally, if no data is received for a player within 10 seconds of that player joining then the player is kicked.

The server script goes inside ServerScriptService, the local script goes inside ReplicatedFirst which prioritises its replication to the client over other instances resulting in its much sooner execution while the game is still loading. These scripts also make use of a single RemoteEvent instance which is placed inside Replicated Storage.

The result of this implementation is a dictionary of dictionaries which can be easily indexed to find controller/device information about any particular client.

1 Like

It still requires a local script, by my question I meant fully Server Sided,

You can’t get information about the client from the server without the client transmitting that data to the server beforehand.

1 Like