Issue with detecting thumbstick movement

So I’ve been trying to detect when the player begins and ends moving their thumbstick. I’m using this for a run script, which normally makes you sprint when you double-tap W on your keyboard, but I would like to add controller support so that you automatically run.

My issue is that detecting thumbstick inputs with ContextActionService seems to have some very weird results.

So let me show you what I mean:
-I’m using only keyboard inputs in this video:

-I’m using only controller inputs in this video:

-I’m using both keyboard and controller inputs in this video:

And here’s my script:

local cas = game:GetService("ContextActionService")

local function ControllerRun(ActionName, InputState)
	print("test1")
	if ActionName == "Run" and InputState == Enum.UserInputState.Begin then
		print("test2")
	end
end

local function ControllerStopRunning(ActionName, InputState)
	print("test3")
	if ActionName == "StopRunning" and InputState == Enum.UserInputState.End then
		print("test4")
	end
end

cas:BindAction("Run",ControllerRun,false,Enum.KeyCode.Thumbstick1)
cas:BindAction("StopRunning", ControllerStopRunning, false,Enum.KeyCode.Thumbstick1)

As you can see, it does not seem to be properly firing when I move my left thumbstick, and to me it seems entirely random, and for some reason it also fires sometimes when I press WASD. I’ve tried changing the action priorities of the events, but that doesn’t seem to work. I have no idea what could be causing this, and I have not tested if this works with UserInputService.

For reference, I’m testing using a dualshock4 controller, with my keyboard and mouse plugged in at the same time. I’m 99% sure that both my controller and my keyboard are functional and not broken, and I’ve already checked to make sure that DevComputerMovementMode is on UserChoice.