Major Gamepad control problem with DevComputerMovementMode set to KeyboardMouse

This is a really nasty bug that has managed to slip under the radar for a bit now.

image

If you set the StarterPlayer’s DevComputerMovementMode to KeyboardMouse, you cannot control your character with a Gamepad.

This has been happening for a few weeks now (even on consoles), but I haven’t looked into it until recently. I figured it was a problem on my end, but apparently not!

I’m not sure if this is the specific cause of the problem, but it does appear to reproduce it.

6 Likes

Just like to point out that naturally this bug makes games which rely on the mentioned movement behaviour completely unplayable for console players.

Gamepad input is still detected with UIS, however there is absolutely no control of the character.

-- demo
game:GetService("UserInputService").InputBegan:Connect(function(Input)
    print(Input.KeyCode)
end)

…will still print the gamepad KeyCodes.

An example of the effect it has on games is: https://www.roblox.com/games/998374377/Super-Nostalgia-Zone, where console users can only move around by using the custom click-to-move feature provided by the developer.

Temporary workaround I’ve come up with. It’s pretty bad.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")

local playerModule = playerScripts:WaitForChild("PlayerModule")
local controlModule = playerModule:WaitForChild("ControlModule")
local gamepad = require(controlModule:WaitForChild("Gamepad"))

playerModule = require(playerModule)
controlModule = playerModule:GetControls()

local function fixGamepad()
	local lastInputType = UserInputService:GetLastInputType()
	
	if lastInputType.Name == "Gamepad1" then
		local controllers = controlModule.controllers
		
		if controlModule.activeController ~= controllers[gamepad] then
			controlModule:SwitchToController(gamepad)
		end
	end
end

RunService:BindToRenderStep("GamepadPatch", 0, fixGamepad)
1 Like