I’m trying to turn the value of DodgeDirection negative when the AKey is true. The AKey 100% becomes true, it’s just that the value that it has never turns negative. I’ve tried multiplying it by -1, and many other ways and it just never turns into a negative version of itself.
I think it’s because the value is a Vector3, and not a number. With x = -x, it would work as an integer, but I’m not entirely sure if it can be done the same with Vector3s.
Maybe I’d get the LookVector, get the xyz values, separately turning them into negatives, then reconstructing it back into a Vector3?
Instead of checking for individual keys, you can use Humanoid.MoveDirection as a dodge direction, unless you need them only in 4 directions
For your solution, just multiply DodgeDirection by negative Vector3.one
Oh, I see now. You tried doing a Vector3.new(1,1,1) = -Vector3.new(1,1,1). Negative Vector3s don’t necessarily exist, as you need to change the values inside.
Both mine and @SolidTurret’s responses are correct. You can either separately make the values negative, to then reconstruct back into a Vector3, or multiply it by negative Vector3.One.
That still doesn’t work for some reason… Either way I’m going to just use movedirection since I should’ve thought of that before. If anyone ends up googling this sorry LOL
I’ve tried straight up setting the vector3 into a completely arbitrary number and it still is at (1, 0, 0) leading me to believe that something else is setting AKey to be (1, 0, 0). What that thing is, I have absolutely no idea.
If you set it to 0,0,0 and it’s still at 1,0,0 then something is definitely changing up the variable in some other if or function statements.
We can see if this is true by having that DodgeDirection being set, then a print right after, to see if it is doing it’s job, but the variable then later gets changed.
If that is the case, then go back to your original DodgeDirection = -DodgeDirection to see if that worked all along.
Nah, I was gonna eventually use it to do something that movedirection would have done way better. I have no idea how it didn’t come to my mind to use movedirection especially since I used it in one of my other functions.