Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to check what device a player is on?

I made admin commands (as you can see on me Scripting Helpers profile), and for those I made a ScreenGui that has a ImageLabel . I want to be in a certain position when player joins on a certain device. I think I know the code for it, I just need to know where to get the device from

2 answers

✓ Accepted answer

What you will be needing is UserInputService. You can learn more about it here. Anyways here the code you will need:

local UserInputService = game:GetService("UserInputService")

if UserInputService.GamepadEnabled then
	print("Player is playing using an Xbox")
elseif UserInputService.KeyboardEnabled then
	print("Player is playing on a pc")
elseif UserInputService.TouchEnabled then
	print("Player is playing on mobile")
end

Hope it helps!

3 comments

0

thanks ill try it

0

thanks this really helped!

0

No worries! Glad to help out :D

local UserInputService = game:GetService("UserInputService")
 
function checkdevice()

if (UserInputService.KeyboardEnabled) then
	return "PC"

elseif (UserInputService.GamepadEnabled) then
	return "Console"


elseif (UserInputService.VREnabled) then
	return "VR"


elseif (UserInputService.TouchEnabled) then
	return "Mobile"

	end

end


print(checkdevice())

This discussion is preserved as it was. New answers, comments, and votes are closed.