Trying to get something from module script

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
1 Like

I think its solution

1 Like

Just wanted to jump in to say that “console platform” is different from gamepadType. Gamepad type is the controller the player uses.

Roblox does not allow developers to get the console of the player, only the controller.

2 Likes

oh thats mb, i worded it wrong. i meant to say i was trying to get the gamepadType from my module script so that i can use it in another but that’s great information to know.

also i was reading your script last night. it was a brilliant resource. tysm for putting that up mate!! :slight_smile:

1 Like