im trying to get the console platform (UserInputType.gamepadType
)
from my module script so that i can use it in another module script. its a string either xbox or playstation. i’m not really sure how tho which is why i need a lil help. tysm!!
code:
function module.GetPlayerPlatform()
local connection = nil
connection = uis.InputBegan:Connect(function(inp)
for i, gamepadInput in pairs(gamepadInputs) do
if inp.KeyCode == gamepadInput then
if UserInputType.PlayerInputType ~= "GamePad" then
UserInputType.PlayerInputType = "GamePad"
end
local stringForKeyPressed = uis:GetStringForKeyCode(gamepadInput)
for _, xboxButton in pairs(XboxButtons) do
if xboxButton == stringForKeyPressed then
UserInputType.gamepadTypeFromNewestInput = "Xbox"
end
end
for _, PlaystationButton in pairs(PlayStationButtons) do
if PlaystationButton == stringForKeyPressed then
UserInputType.gamepadTypeFromNewestInput = "PlayStation"
end
end
if UserInputType.gamepadTypeFromNewestInput ~= UserInputType.gamepadType then
UserInputType.gamepadType = UserInputType.gamepadTypeFromNewestInput
print(UserInputType.gamepadType)
end
end
end
end)
end