this solves one axis but ive been picking my brain out to try and redirect the part towards the boss on the other axis (this happens when im moving around the boss and not right infront of it)
Hello! This confused me too, and I did a little digging and found that BodyVelocity is deprecated, so maybe that is why it acts a little funky?
I ended up finding a solution with code similar to yours using LinearVelocity, which is the reccomended replacement for it.
--LinearVelocity requires an attachment, so create one and parent it to the projectile
local attachment = Instance.new("Attachment", projectileAttackSphere)
local newVelocity = Instance.new("LinearVelocity")
newVelocity.MaxForce = 4000
newVelocity.Parent = projectileAttackSphere;
newVelocity.Attachment0 = a0
local direction = (boss.HumanoidRootPart.Position - projectileAttackSphere.Position).Unit
newVelocity.VectorVelocity = direction * 80
Hope this helps! The code should be decently self-explanatory, the Velocity property is just named VectorVelocity instead!
This works exactly like i wanted it too thank you! another question when it reaches the designated goal how can i detect that? Thanks again for the solution you are a life saver!
-- The distance between the points
(boss.HumanoidRootPart.Position - projectileAttackSphere.Position).Magnitude
Just check the magnitude while the projectile is in the air, magnitude checks like this are very performant. AFAIK the .Touched event is not recommended, so while that is also an option, magnitude checks are probably better if you plan to have many projectiles like this!