Hi. While scripting a knockback mechanism for my combat system, I encountered a glitch. Whenever the body position for the knockback is applied to the player, they glitch back a couple studs before the body position ends.
Script:
(Local root = root of player that is attacking,
Enemy root = root of player getting attacked/knocked back)
local bodyPosition = Instance.new("BodyPosition")
bodyPosition.Parent = enemyRoot
bodyPosition.MaxForce = Vector3.new(math.huge, 0, math.huge)
bodyPosition.Position = localRoot.Position + localRoot.CFrame.LookVector * 30
bodyPosition.P = 9999
bodyPosition.D = 1000
Video: