Hi. I am trying to script a dash system but it is not working the way I want it to. It is good when the player isn’t doing fast shift-lock camera movements. The current script is:
local bodyPosition = Instance.new(BodyPosition)
bodyPosition.Parent = character.HumanoidRootPart
bodyPosition.Position = (character.HumanoidRootPart.CFrame * CFrame.new(80, 0, 0)).Position
bodyPosition.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bodyPosition.P = 100000
bodyPosition.D = 5000
I really don’t know how I can explain the problem, so I am putting a gyazo replay here. MagicTool1 - Roblox Studio (gyazo.com)
The first dash looks good. However in second dash, when I do a sudden camera movement, the dash script doesn’t follow my movements, it still dashes to the old right position. What I want it to do is to make it dash to the new right side of the character. I am really confused and I have no idea about how to fix it.
Edit: Also I am making sure that I press my dash button right after I turn the camera, not before.