Server Authority: How to make enemies deal smooth knockback on the player?

I tested a “Knockback” made by the server on the character (while true do wait(3) applyimpulsetoplayer end). It results in rubberbanding/isn`t smooth.

Server Code used for Test

while true do
	wait(3)
	local p = game.Players:FindFirstChild("Dfzoz")
	if p then
		local c = p.Character
		if c and workspace:IsAncestorOf(c) then
			local rootPart = c:FindFirstChild("HumanoidRootPart")
			if rootPart then rootPart:ApplyImpulse(Vector3.new(0,3500,0)) end
		end
	end
end

Other methods results in this, too. I already made some action movements smooth with server authority, but all of them come from the player. How do I do this with external factors, like enemy damage, explosions, etc? Should I somehow implement this knockback on BindToSimulation on both server and client? If so, would this recquire making the instance replicate on both server and client? (“Example: rocket launcher projectile be calculated on bindtosimulation both on server and client, and predict if there should be a knockback with the delta time?”)

1 Like

Have you tried using RunService:BindToSimulation?

I did, but It doesnt matter for this occasion, because the input comes from the server, not the client, so there is nothing for the player to predict when running the BindToSimulation

Have you tried using Mover Constraints instead of using ApplyImpluse?

I didnt, but I believe the issue isnt How I move the character, but How I make the client predict that the knockback Will happen before the server ia excused to rollback the client. On slow, simple external factores its easier to do (a slow missile that deals knockback when It explodes), because you can apply the same knockback logic and event and setpredictionmode of the missile to on. Now, dealing knockback because of a instantaneous hitbox that spawned on top of the players might be harder to do. What really might help is a way to smooth out the rollback in those cases.