Restrict devices in games that we don't want to support with those device

Does anyone know how to restrict certain devices that we want to make unsupported in our game so that players on that device cannot enter for examples like mobile player cannot join and Roblox give information for this game cannot be entered example game : phantom forces pc

Why I need this?

  1. to be able to separate support across various devices

  2. to make it easier for me when it comes to bugs on devices that don’t support the game

Thank you for reading and giving answers

1 Like

You can get the platform through Roblox.
but you cannot get the model of the device (in a supported way).

To completely disable mobile players from joining:

  • Simply change the allowed platforms to not include mobile.

OR

Kick or redirect mobile players as soon as they join.

  • Here is a script for redirecting:

  • (Quickly thrown together, so it might not work.)

local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local TPS = game:GetService("TeleportService")
local PLAYER = game.Players.LocalPlayer
local PLACEID = 1234567890 -- Replace with Game ID
local triggered = false
local IsMobile

function DetectInput()
	local lastInput = UIS:GetLastInputType()
	if lastInput == Enum.UserInputType.Focus then return end
	IsMobile = lastInput == Enum.UserInputType.Touch
end

DetectInput()
UIS.LastInputTypeChanged:Connect(DetectInput) 


RS.RenderStepped:Connect(function()
	if IsMobile and not triggered and not UIS.MouseEnabled then
		triggered = true
		print("is mobile")
		TPS:Teleport(PLACEID, PLAYER)
	end
end)

Kicking:

local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local PLAYER = game.Players.LocalPlayer
local triggered = false
local IsMobile

function DetectInput()
	local lastInput = UIS:GetLastInputType()
	if lastInput == Enum.UserInputType.Focus then return end
	IsMobile = lastInput == Enum.UserInputType.Touch
end

DetectInput()
UIS.LastInputTypeChanged:Connect(DetectInput) 


RS.RenderStepped:Connect(function()
	if IsMobile and not triggered and not UIS.MouseEnabled then
		triggered = true
		print("is mobile")
		PLAYER:Kick("Your Device Isnt Supported")
	end
end)

Now, if you want to detect a certain model of device, you can’t do it natively.

You could detect the device’s resolution, then the type of device.
There could be other ways, but I’m not too sure.
Anyway, I hope I can help. If you have any questions, let me know.

3 Likes

Yeah, you change what platforms can access the game through game settings.

3 Likes

I would say this is a great example! + You can teleport mobile players to a specific place for them later on etc.

3 Likes

This also kicks any users that use a touchscreen on PC, is that intended?

3 Likes

Whoops! My Bad, i will edit in
not UIS.MouseEnabled then
to detect if there is not mouse connected to kick the player.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.