How to move player forward in a ray

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hello,So I want my player to move forward,Using mouse.Hit.p to change into direction

  2. **What is the issue?**Im not sure how to start,The player is not confined on one axis and the teleportation must use local dir = (pos - script.Parent.Parent.Head.Position).Unit but im not sure how to implement into teleportation foward

  3. What solutions have you tried so far? ive try dev hub but the closes thing is PivotTo which dont work as expected
    here’s my current code

local dir = (pos - script.Parent.Parent.Head.Position).Unit
		local currentPivot = script.Parent.Parent:GetPivot()
		script.Parent.Parent:PivotTo(dir * CFrame.new(0, 0, -10))
1 Like

What is the final goal of it? A teleportation move?

Yes,To teleport foward using mouse direction

Personnaly i would use the LookAt cframe to displace your char through his HumanoidRootPart. Something like:
HRP.CFame = CFrame.new(mouse.Hit.P, HRP.Position)

And it works just fine for me

No that’d teleport the player to the mouse hit,I want it to go forward

This would make your char teleporting 10 studs where he looks at
HRP.CFrame *= CFrame.new(0, 0, -10)

Umm is there in any chance that you can put local dir = (pos - script.Parent.Parent.Head.Position).Unit instead?

yes but then, if you want an updated variable, you will have to update the variable manually