Lukiraq
(borge)
April 6, 2024, 10:04pm
#1
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)
1 Like
p49p0
(Panthera)
April 6, 2024, 10:10pm
#2
why not use LinearVelocity ? easier in my opinion
2 Likes
Lukiraq
(borge)
April 6, 2024, 10:14pm
#3
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
p49p0
(Panthera)
April 6, 2024, 10:24pm
#4
you can use linearvelocity using 1 attachment, i use it for vehicles also yeah anything you can set by a script
2 Likes
Lukiraq
(borge)
April 6, 2024, 11:02pm
#5
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
p49p0
(Panthera)
April 7, 2024, 1:07am
#6
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