Help me with my lightsaber throw

First of all i need it to spin which i have failed multiple times at, i also want it to more effective but tinkering with body positions never really helps me. I have never done anything like this before by the way so sorry if im dumb

(Note im not doing character animations yet)

Here is a clip of what i want it to look like:

And what mine looks like:

Any help appreciated!

Here is the code:

script.Parent:WaitForChild("Throw").OnServerEvent:Connect(function(plr,handleM)

	local handle = handleM:Clone()
	handle.Parent = game.Workspace
	handle:SetNetworkOwner(nil)
	
	handleM.Transparency = 1
	for i,v in pairs(handleM:GetDescendants()) do
		if v:IsA("Part") or v:IsA("UnionOperation") then
			v.Transparency = 1
		end
	end
	
	handle.Trail.Enabled = true
	
	local bf = Instance.new("BodyVelocity",handle)
	bf.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector*150
	bf.P = 1250
	bf.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	wait(1)
	
	bf:Destroy()
	
	local bp = Instance.new("BodyPosition",handle)
	bp.Position = plr.Character.HumanoidRootPart.Position
	bp.MaxForce=  Vector3.new(math.huge,math.huge,math.huge)
	bp.P = 100000
	bp.D = 3500
	
	repeat wait()
		bp.Position = plr.Character:FindFirstChild("Right Arm").Position
	until (handle.Position-plr.Character:FindFirstChild("Right Arm").Position).magnitude < 5

	for i,v in pairs(handleM:GetDescendants()) do
		if v:IsA("Part") or v:IsA("UnionOperation") then
			v.Transparency = 0
		end
	end
	handleM.Transparency = 0
	handle:Destroy()
end)
1 Like

For the movement from the player and back, you should use attachments as that will remove the need for a constant position update when bringing the lightsaber back to the player.
As for the spin, try connecting the forces to an attachment or invisible part that has a hinge the lightsaber can spin on.

1 Like

ty for the reply but what code would i need to use attachments, as i can understand what your saying but dont know how to execute it

It’s just a matter of creating an Attachment for the player, lightsaber, and target location, creating a HingeConstraint for the lightsaber attachment and it’s handle, and giving them values for their properties.
Two things however:

  1. Only parent instances after you have finished setting them up (e.g applying properties)
  2. BodyMovers are deprecated, and you should use alternatives such as LineForces for this.

I like @TestyLike3 approach on this.

Also you would want to create an animation for the throw, and time it correctly to make it look realistic. Easy enough make sure its AnimationPriority is set to Action.

Then I would also make sure the animation is ServerSided so everyone can see it.

Another tutorial for that can be located HERE.

Loading animations on the client is better then on then server and everyone can see them… I also said im not doing animations right now