How to make my sprint work?

Godot 4.3

Hi! I am currently working on a godot project and I need my sprint button (shift) to make you go faster when held down while pressing left or right, and when it is released, making you go back to your regular speed.

Here’s what I tried:

if Input.is_action_just_pressed("run"):
	const SPEED = 800.0

if Input.is_action_just_released("run"):
	const SPEED = 600.0

The easiest way to fix your code is just to remove the “const” prefix and it should work

The problem with this is that a const, or constant, which will never change. It’s for vars you don’t want changing internally. But for your sprint function, you’ll want it to change. Make sense?

thanks a lot!