Movement speed decrease while firing (my last post disapearred)?

How do i decrease movement speed while firing in workshop? Someone gave me the code I needed in my last post, but it got deleted.

Conditions would be “Button held”, or “Is firing primary/secondary” and then the actions would be setting the movement speed to a big number, any amount is okay, and then make another rule where if the said conditions are false, put an action where it sets movement speed back to 100

rule("d.va movement speed slow")
{
	event
	{
		Ongoing - Each Player;
		All;
		D.Va;
	}

	conditions
	{
		Is Firing Primary(Event Player) == True;
	}

	actions
	{
		Set Move Speed(Event Player, 5);
	}
}

rule("d.va movement speed unslow")
{
	event
	{
		Ongoing - Each Player;
		All;
		D.Va;
	}

	conditions
	{
		Is Firing Primary(Event Player) != True;
	}

	actions
	{
		Set Move Speed(Event Player, 100);
	}
}

From the deleted post (I have no idea what happened to it)

thank you for the code, it worked

His script works and all but can be improved to fit in one rule:
rule(“Rule 1”)
{
event
{
Ongoing - Each Player;
All;
Reinhardt;
}

conditions
{
	Is Button Held(Event Player, Primary Fire) == True;
}

actions
{
	While(Is Button Held(Event Player, Primary Fire));
		Set Move Speed(Event Player, 50);
		Wait(0.050, Ignore Condition);
	End;
	Set Move Speed(Event Player, 100);
}

}

The drawback to this one is it will junk up the Workshop Inspector since it is a loop.

Not really, since this loop will use a lot of resources for nothing. Moving the “Set Move Speed(Event Player, 50);” on top of the loop will let it perform slightly better. But the better solution is SpaceJester’s imo, even though it uses 2 rules.