How do I make it so my throwable knife doesn't "pause" or "stutter" before moving?

Hello, the title says it all. I can’t exactly get a video of this from my computer, but I can link my game for you guys to see.

My exact issue was also posted here, but no one really had a solution.

My game where the issue can be seen:

To see what I mean, equip the knife. Next, click and hold to enter the throwing animation. Release once the animation has started and you should notice that the knife that was thrown hovers for a moment and then moves foward. I will try to edit this post to get a video of what I mean.

My throwing code:

local throwingHandle = handle:Clone()
		throwingHandle.Velocity = (target - throwingHandle.CFrame.p).unit * 100
		-- set the orientation to the direction it is being thrown in
		throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90))
		local floatingForce = Instance.new('BodyForce', throwingHandle)
		floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0)
		local spin = Instance.new('BodyAngularVelocity', throwingHandle)
		spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -200, 0))

		throwingHandle.Parent = workspace
		game.Debris:AddItem(throwingHandle,5)

EDIT: I managed to record a video.

If you want to see the knife stutter in air, look at about 0:03 in the clip.

Hey, is the whole knife model made up with separate parts or it is in one union/mesh part?

It is one part, with a simple mesh in it. I should add that the extra knife is created by a server script.

Try doing:

throwingHandle:SetNetworkOwner(nil)

Might have to do with network ownership, that’s usually why things stutter as they move away from a player

2 Likes

Now my knife won’t even throw or appear… there is an error.

Can only call Network Ownership API on a part that is a descendent of Workspace

Oh, the script is in a local script?

Yep it’s probably a networking issue, when you create a new projectile on the server it takes time hence a delay for the instances to replicate from the top down model hence lag.

To solve this create the projectile before hand using nexus avengers buffer method wrapped by bombsrain in this module.

That just means you set the network owner of the knife before setting the parent of the knife to the workspace.

Nope. I have a server script that requires a module based on the player’s knife effect. In this case, I just want to fix it for the default knife effect.

(Heres how it is set up: Knife Tool > Server Script > A bunch of module scripts

Can I see the how the hierarchy looks like in the explorer tab?

I set it to workspace before I set the ownership, yet I still get that error.

local throwingHandle = handle:Clone()
		throwingHandle.Parent = workspace
		
		throwingHandle:SetNetworkOwner(nil)

Just to give you a tip, that error means the API only allows the server to take control of the part’s physics if only that part is either a children or descendant of workspace.

image_of_knife_objects

Where was the tool parented to?

1 Like

Workspace?

local throwingHandle = handle:Clone()
throwingHandle.Parent = workspace
		
throwingHandle:SetNetworkOwner(nil)

Where is this block of code located? I think it’s running before the tool is even parented to whatever player.

1 Like

Its in a module script labeled Default in the image I sent earlier. Here is the code that requires that module.

script.Parent.Events.Throw.OnServerEvent:Connect(function(player,target,cframe)
	if db.Value == false then
		db.Value = true
		
		local effect = script.Parent.Values.Effect
		require(script[effect.Value]).Throw(player,target,cframe,script.Parent.Handle,script.Parent.Effects)
		
		wait(cooldown)
		
		db.Value = false
	end
end)

Playtest your game, hold out the tool, and see if it’s inside your character model.

Alright, I just playtested. Here is what I did:

I held out the tool — It is in my character.

I disabled the :SetNetworkOwner(nil) temporarily so I can throw a projectile without it erroring and not throwing anything at all.

When I throw the knife, the new projectile is parented to workspace, not my character.