I would like to understand why this doesn't work and the proper way to code this. The $AnimatedSprite.play("Run") is the correct name of the animation.
I'm not worried about physics right now I'm just trying to get the animations to respond with the keys.

func _physics_process(delta):
	
	if Input.is_action_pressed("ui_right"):
		$AnimatedSprite.play("Walk")
		$AnimatedSprite.flip_h = false
	elif Input.is_action_pressed("ui_right") and Input.is_action_pressed("Shift"):    
		$AnimatedSprite.play("Run")
		
	elif Input.is_action_pressed("ui_left"):
		$AnimatedSprite.play("Walk")
		$AnimatedSprite.flip_h = true	
		
	else:
		$AnimatedSprite.play("Idle")	

How is the animation not working? Is it not playing or getting stuck on the first frame or something?

If the animation is not playing then it could be that using is_action_pressed for an action bound to the shift key doesn’t return true if combined with another key press, or (potentially) the input is not setup in the project settings. Based on some quick Google searches, it looks like detecting if shift is pressed/held is quite involved, so that might be the issue. Apparently making an action that is mapped to key + shift in the actual input may work?

If the issue is the animation is getting stuck on the first frame, it could be that calling play is overriding the animation before it has a chance to progress. What I would recommend doing in that case is checking to see if the animation is different, like if $AnimatedSprite.animation != “run”:, and then only changing the animation if its different.

@TwistedTwigleg

The animation was getting stuck on the first frame I believe. I managed to fix the issue. My code is so janky, I feel like I need to start fresh with a better understanding of GD Script or Python in general. Here's the changes that fixed the Run animation issue.

	if Input.is_action_pressed("ui_right") and Input.is_action_pressed("Shift"):
		motion.x = min(motion.x+ACCEL, MAX_SPEED * 1.7)
		$AnimatedSprite.flip_h = false
		$AnimatedSprite.play("Run")
		
	elif Input.is_action_pressed("ui_right"):
		motion.x = min(motion.x+ACCEL, MAX_SPEED)
		$AnimatedSprite.flip_h = false
		$AnimatedSprite.play("Walk")

What I'm doing is googling what I want my character to do and then sort of creating this frankenstein code that kind of works. It's not very practical but I'm slowly learning better techniques.

a year later