This can be found through simply searching the wiki or the Devforum , but One way you can do this is by using the UserInputService:
(this, isn’t a perfect solution, because as far as i know there isn’t any way to directly/100% accurately detect a player’s device, at least while using normal scripts (non-core scripts) )
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UserInputService.TouchEnabled and not (UserInputService.KeyboardEnabled and UserInputService.GamepadEnabled and GuiService:IsTenFootInterface()) then
--player is using a mobile device
else if UserInputService.KeyboardEnabled then
-----player is on Pc (or a Pc emulator)
end
end
this particular example can be found here:
How to detect if Player is using a Phone? - #4 by buildthomas