Trying to prevent knife projectile from falling to the ground

i made this knife throwing script but it’s falling to the ground. i don’t want there to be any drop. i just want it to go to the mouse position.

this is what i got:

				throwknife_animtrack:GetMarkerReachedSignal("clone_knife"):Connect(function()
					local knife_model = game.ReplicatedStorage:WaitForChild("knife_model")
					local knife_clone = knife_model:Clone()
					knife_clone.Parent = workspace
					knife_collision(false, 1)
					knife_clone:PivotTo(knife.PrimaryPart.CFrame)

					local knifeclone_pos = knife_clone.PrimaryPart.Position
					local mouse_pos = mouse.Hit.Position
					local direction = (mouse_pos - knifeclone_pos).Unit
					local throw_speed = 100
					knifeclone_massless(knife_clone)
					knife_clone.PrimaryPart.AssemblyLinearVelocity = CFrame.new(knife_clone.PrimaryPart.Position, mouse_pos).LookVector * throw_speed

				end)

all good i fixed it.

				throwknife_animtrack:GetMarkerReachedSignal("clone_knife"):Connect(function()
					local knife_model = game.ReplicatedStorage:WaitForChild("knife_model")
					local vf:VectorForce = knife_model.PrimaryPart.VectorForce
					local knife_clone = knife_model:Clone()
					knife_clone.Parent = workspace
					knife_collision(false, 1)
					knife_clone:PivotTo(knife.PrimaryPart.CFrame)

					local knifeclone_pos = knife_clone.PrimaryPart.Position
					local mouse_pos = mouse.Hit.Position
					local direction = (mouse_pos - knifeclone_pos).Unit
					local throw_speed = 100
					vf.Force = Vector3.new(0, workspace.Gravity * knife_clone.PrimaryPart.AssemblyMass, 0)
					knife_clone.PrimaryPart.CFrame = CFrame.new(knife_clone.PrimaryPart.Position, mouse.Hit.Position)
					knife_clone.PrimaryPart.AssemblyLinearVelocity = direction * throw_speed
				end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.