local from = Camera.CoordinateFrame.p local to = mouse.Hit.p local ignore = {workspace} local ray = Ray.new( from, (to - from).unit * 1000) local newTarget, newHit = workspace:FindPartOnRayWithIgnoreList(ray, ignore) local hrp = plr.Character:WaitForChild("HumanoidRootPart") hrp.CFrame = CFrame.new(hrp.Position, newHit - Vector3.new(0,newHit.Y,0) + Vector3.new(0, hrp.Position.Y, 0) )
The ray in the script above is applied to the LocalPlayer's HumanoidRootPart every Step and looks something like this
all nice and dandy, right? ok now the problem is this.
local tween = game:GetService("TweenService"):Create(part, tweenInfo, {Position = plr.Character.Head.CFrame.lookVector * 250}) tween:Play()
if I try to tween a part according to the head's lookVector it works fine... as long as I don't press A, S or D.
If I press either of them the lookVector goes off-track, despite the animation playing and the head being straight in place.
This is it normally (how it's supposed to be)
And this is how it is when you press A, S or D
Extra notes: This happens to all parts, including LowerTorso, UpperTorso, HumanoidRootPart, Head. This is not because the camera script is a localscript, I already tried executing that code in a localscript and the same thing happens with A, S, D.
I have tried a lot of things, such as Anchoring, changing the walkspeed to 0, stopping the animations, but as long as you press one of those 3 buttons the lookVector will change.
I am getting desperate because I am probably going to have to scrap the move (along with many others) or even the entire aiming system if I don't find a way to fix it.
i notice that your torso changes accordingly to the animation, so either change the animation, or even better, use the cframe of the head or the camera