Knockback delay

So I’m making a fighting game and I can’t one thing. Why is my knockback not “clean”?

How it looks like:

How I want it to look like:

I also found out that if I wait in the server for around a minute, the issue will be gone but only for dummies and not players.

 	local bv = Instance.new("BodyVelocity", data.Character.PrimaryPart)
	bv.Velocity = data.Character.PrimaryPart.CFrame.LookVector * 10
	bv.MaxForce = Vector3.new(99999, 99999, 99999)
	bv.Name = "Velocity"
	game.Debris:AddItem(bv, .2)
			
	local bv = Instance.new("BodyVelocity", data.Target.PrimaryPart)
	bv.Velocity = data.Character.PrimaryPart.CFrame.LookVector * 10
	bv.MaxForce = Vector3.new(99999, 99999, 99999)
	bv.Name = "Velocity"
	game.Debris:AddItem(bv, .2)
2 Likes

Programmer discovers lag

If whatever attack that does this has an animation, signal the server at the start of the attack, subtract your ping from the amount of time between the start of the attack (when u sent signal) and when the knockback effect should be applied, and it’ll be synced.

3 Likes

How exactly do I “subtract my ping”? Could you explain it to me?

1 Like

I’m not on devforum often, so my responses may be delayed. But you take the player ping (for ex; 40 ms) and subtract that from the amount of time between when the effect should be applied and the start of the animation (when the server is fired). This would look like (TimeWhenEffectShouldBeAppliedAfterAnimationStart - PlayerPing) :: number
You then play the effect after this ^ amount of time.

1 Like

I understand, but how do I get player’s ping?

2 Likes