Debris affecting LinearVelocity behavior


In this clip, you can see how the lv is pretty smooth; no debris is used here, which is obviously a problem because it’ll infinitely move the person back


In this clip, you can see how debris makes the lv jittery. Same problem if you do something like:

task.delay(0.05, function()
lv:Destroy()
end)

Heres my code:

function CombatServer:Ragdoll(plrchar, enemychar, force)
	local eHRP = enemychar:WaitForChild("HumanoidRootPart")
	local pHRP = plrchar:WaitForChild("HumanoidRootPart")
	
	local RV = Instance.new("BodyAngularVelocity")
	RV.MaxTorque = Vector3.new(1e9, 0, 1e9)
	RV.AngularVelocity = Vector3.new(math.random(-50,50), math.random(-50,50), math.random(-50,50))
	RV.Parent = eHRP
	--game:GetService("Debris"):AddItem(RV, 0.05)
end

Messing with the .Enabled property does the same thing btw

2 Likes

Figured out a kinda dumb solution from this post: Stuttering Replication with LinearVelocity - #6 by pIaycosa

local eHRP = enemychar:WaitForChild("HumanoidRootPart")
	local pHRP = plrchar:WaitForChild("HumanoidRootPart")
	
	local lv = enemychar:FindFirstChild("Knockback")
	lv.Attachment0 = eHRP.RootAttachment
	lv.MaxForce = force * 10000
	lv.LineVelocity = force * 2
	lv.LineDirection = pHRP.CFrame.LookVector
	task.delay(0.1, function()
		lv.MaxForce = 0
	end)

I guess this isn’t too bad either cause you’re not going to be creating and destroying instances over and over again, so maybe actually more performant

3 Likes

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