Hey Guys,

I’m having trouble with a float for modding movement speed. It works fine unless I set it to ‘0.5’ and then it will stop movement all together. 0.4, or even 0.1 works. I’m guessing this comes down to some math problem that I’m not aware of?

My Iron Sight script changes “Walk_Speed” to .5, instead of the default .6.

I’m aware that there is a disconnection in the bottom section, and I’m just leaving it their incase I do want to allow sideway sprint.

Any help would be much appreciated!

Cheers,

The modulo (%) operator returns the remainder after dividing the two float inputs, right. Assuming WalkForward is an axis event tied to keyboard inputs (like W and S), then you’re going to get steady streams of +1s, 0s and -1s as input values. Dividing these by a WalkSpeed of 0.5 creates values of +2.0, 0.0 and -2.0 … all of which have .0 as a remainder. I’m guessing this is why your movement stops altogether.

For the same reason, a WalkSpeed of 0.1 (or 0.2 or 0.25 or 1.0 etc etc) shouldn’t work either. You’ll probably want to find another solution here.