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?
to be able to separate support across various devices
to make it easier for me when it comes to bugs on devices that don’t support the game
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.