how do i see if a player is on xbox or playstation
local function getConsole(): string
return ({ButtonA="xbox",ButtonCross="playstation"})[game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.ButtonA)]
end
This returns either "xbox"
or "playstation"
:)
3 Likes
You could create a system where you detect if the button is _ or _. And then you assimilate then with XBox and Playstation:
local UIS = game:GetService("UserInputService")
local controllerType
local function findControllerType()
local buttonType = UIS:GetStringForKeyCode(Enum.KeyCode.ButtonA)
if buttonType == "ButtonCross" then
return "Playstation"
end
if buttonType == "ButtonA" then
return "XBox"
end
return "None"
end
controllerType = findControllerType()
1 Like