It works almost well except when I change the way the player is facing, it won’t recognize that and still go in the direction its already pre planned to do.
Now if I were to use lookvector or rightvector it will, but it will update in the direction I turn rather then continue in the direction you flicked.
Code:
local flickDirection
if stateManager.GetStates("FlickLeft") then
if not flickDirection then
flickDirection = Vector3.new(-1, 0, 0)
end
local newVelocity = flickDirection * 50 + Vector3.new(0, Torso.Velocity.Y, 0)
Torso.Velocity = newVelocity
Humanoid.WalkSpeed = 30
isAccelerating = false
elseif stateManager.GetStates("FlickRight") then
if not flickDirection then
flickDirection = Vector3.new(1, 0, 0)
end
local newVelocity = flickDirection * 50 + Vector3.new(0, Torso.Velocity.Y, 0)
Torso.Velocity = newVelocity
Humanoid.WalkSpeed = 30
isAccelerating = false
end
Like I said, if I use anything relative to the parts on the player it will go in the direction continously. So if I do side step left or right it will go in those directions but not at a fixed direction, it will update as a turn.
Lets say I flick towards the pole, it should continue to go to the pole no matter which way I turn after flicking (which my script already does), but using the velocity relative to the player, if I were to turn away from the pole the velocity will be applied to the direction change instead of still going towards the pole.
The issue I’m running into here is that I can’t figure out way for it to go at a fixed direction relative to the players torso without the velocity updating the direction the torso is while in the flicking state.