How do I set a VectorForce to go in a direction

How do I set the “direction” force of a VectorForce in a script?
I want it to go from Part.Position > AnotherPart.Position
I tried:

script.Parent.HumanoidRootPart.VectorForce.Force=Vector3.new(0,0,(character.HumanoidRootPart.Position-script.Parent.HumanoidRootPart.Position).Magnitude*10000)

But that didn’t work.

(made in paint)
force

1 Like

why not use LinearVelocity? easier in my opinion

2 Likes

I have one attachment and I think I have to use two for that also I want to set it in a script

Tell me if im wrong? (I never used LineForce with 1 attachment so I dont know)

1 Like

you can use linearvelocity using 1 attachment, i use it for vehicles also yeah anything you can set by a script

2 Likes

How do I do that exactly?
This is what I tried:

script.Parent.HumanoidRootPart.LinearVelocity.VectorVelocity=CFrame.new(script.Parent.HumanoidRootPart.Position,character.HumanoidRootPart.Position).LookVector*100000

But it didn’t work. Can you provide a code sample please? (character.HumanoidRootPart is target)

1 Like

this is a piece of my code:

local LinearVelocity = Instance.new("LinearVelocity", Part) -- part that u want to move
LinearVelocity.Attachment0 = Attachment -- attachment in the part
LinearVelocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis -- enables the MaxAxesForce prop
LinearVelocity.MaxAxesForce = Vector3.new(math.huge, 0, 0) -- the force for each axis
LinearVelocity.VectorVelocity = Vector3.new(1, 0, 0) -- the direction
1 Like