Your idea is correct. You can change the variable depending on if sprint button is clicked at the moment
and check it in the “when W key is pressed” block
I created a sample space for you https://cospac.es/gHRw. Feel free to remix and explore it.