How to make a thrown object return using body position?

after some hard thoughts i decided to switch my throwing script to bodypos. i have managed to make it able to throw, but it will not return.

i’m not asking too much, but here is what i thought would work, but isn’t although it is not returning any errors.

	local bp = Instance.new("BodyPosition")
	bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	bp.Position = character.HumanoidRootPart.CFrame.LookVector * 200
	bp.P = 300
	bp.Parent = axeclone

	local bav = Instance.new("BodyAngularVelocity")
	bav.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

	bav.AngularVelocity = axeclone.CFrame:VectorToWorldSpace(Vector3.new(25,15,10))
	bav.Parent = axeclone

	game.ReplicatedStorage.ClientAxe:FireAllClients(axeclone, axe.Parent)

	axeclone.Touched:Connect(function(touched)

		if touched.Transparency < 1 and not axe.Parent:IsAncestorOf(touched) then 

			local humanoid = touched.Parent:FindFirstChild("Humanoid") or touched.Parent.Parent:FindFirstChild("Humanoid")

			if humanoid then

				humanoid:TakeDamage(25)
			end

			axeclone.Anchored = true
			wait(1)
			axeclone:Destroy()
		end
	end)

	wait(1)
	bp = handle.Position
	wait(0.5)
	axeclone:Destroy()
	handle.Transparency = 0
	wait(1)
	isCooldown = false
end)

this is what the concept is:
https://i.gyazo.com/2632496a14e0609b4c114aed2835fd6b.gif
this is what happens:
https://i.gyazo.com/c6c6ecc6145390965be39658a2eb7271.mp4
hope it helps!

1 Like

shouldnt you try to use Bézier Curves??

(I may be wrong)

2 Likes

i’m not too familiar with bezier curves, so i decided that body pos would be a bit easier

1 Like

Well then, sorry I cant help you… I’m not familiar with bezier curves too, else i would have help you
Sorry, but goodluck

I’ve created a custom Bezier module containing implementations of quadratic and cubic Bezier curves that you can use. Tried to make it similar to how you would create a tween, so it has a .new() function, a :Play() function, and of course the .Completed property. Here’s the file - BezierTween.rbxm (1.4 KB). It should do exactly what it does on the devhub but in 3D space.

Here’s how to use it:

-- Quadratic
function Bezier.Quad.new(
    --[[ The instance, also the starting point (P0) ]], 
    --[[ The amount of seconds ]],
    --[[ The first curve point, a Vector3 value (P1) ]],
    --[[ The end point, a Vector3 value (P2) ]]
)

-- Cubic
function Bezier.Cubic.new(
    --[[ The instance, also the starting point (P1) ]], 
    --[[ The amount of seconds ]],
    --[[ The first curve point, a Vector3 value (P1) ]],
    --[[ The second curve point, a Vector3 value (P2) ]],
    --[[ The end point, a Vector3 value (P3) ]]
)

Here’s an example:

local bezier = require(pathToModule)

-- I'm using preset parts in the workspace here as P1, P2 and P3
-- In your case though you need to generate the Vector3's according to the player position and orientation

-- Quadratic
local part = workspace.SomePart
local curveVector = workspace.CurvePart.Position
local endVector = workspace.EndPart.Position

local quad = bezier.Quad.new(part, 4, curveVector, endVector)
quad:Play()
repeat task.wait() until quad.Completed
print("Completed the quadratic curve!")

-- Cubic
local cubic = bezier.Cubic.new(part, 4, curveVector, endVector)
cubic:Play()
repeat task.wait() until cubic.Completed
print("Completed the cubic curve!")

You should now be able to make a circle tween with a cubic Bezier curve. But if you still can’t, here’s an example of the part placements. The yellow part represents the part you want to move, the red one represents the start point, the green one represents the end point and the two blue ones represent the “curve” points:


If I now create the curve and play it, I get this result:
440bdec6ac2e85d8f7ddabf9a980c8a3

You can launch the axe like that and equip it once the .Completed property is true.
Hope that helps!