Hello!

I need help with a body velocity being glitchy, here's an example video (Along with the code used)

Video:

https://gyazo.com/7b581060c21116699b0d7a33f1bbd577

Code:

local function addKnockback(root,vel,lifeTime,friendly)
	local kb = Instance.new("BodyVelocity",root)
	
	if not friendly then -- friendly means that if it is not the target, it will give a different name, not really important.
		kb.Name = "KnockbackBV"
	else
		kb.Name = "PushBV"
	end
	
	kb.MaxForce = Vector3.new(math.huge,0,math.huge) -- Setting Body Velocity's Max Force to math.huge
	kb.Velocity = vel -- this is just setting the velocity of the body velocity.
	
	game.Debris:AddItem(kb,lifeTime) -- We need to destroy the force so it doesn't go on forever
end

I tried to make this as detailed as I could, please let me know if you need more details!

1 comment