Help With Melee System Delays

I have a melee combat system where players can “push other people”. On the backend the system uses the RaycastHitbox module and will detect another player/NPC. Then for the push attack it will put a VectorForce in the HumanoidRootPart of the player who’s being pushed. When being pushed I set the target player’s NetworkOwnership to nil/server to prevent exploiting. But there’s a delay on both the player whos punching and the player being pushed. How can I make this seamless without any latency?

While changing NetworkOwnership to server

There’s still delay even without setting the network ownership to the server (not for NPCs because they are unanchored and would be managed by the local client but in a real PVP scenario there would be a delay)

Here’s what it looks like without touching NetworkOwnership (I have the NPCs permanently set their network ownership to replicate the network of another player, because the NPCs are unanchored and would just be treated as the client)


1 Like


Thirtyyyyy Character Limit

May you provide your code? Maybe it has something to do with the sequence you run the animation and push etc. such as you only run the push after the animation is complete. Also, why vectorforce? It seems stiff, try using planevelocity of linearvelocity? Anyways we may need your code to diagnose the issue.

1 Like

Kind of interesting that you think it would be a code issue, but I guess it’s still good to not rule it out. Regardless here’s my server code

if Ability == "Push" then
		local RightArm = Character:WaitForChild("Right Arm")
		local LeftArm = Character:WaitForChild("Left Arm")
		local RightGripAttachment = RightArm:WaitForChild("RightGripAttachment")
		local LeftGripAttachment = LeftArm:WaitForChild("LeftGripAttachment")
		local PunchTrack = Animator:LoadAnimation(PunchAnimation)
		PunchTrack.Looped = false
		PunchTrack.Priority = Enum.AnimationPriority.Action4
		local CharactersToAffect = {}
			if Name == "Damage" then
				local Params =
				Params.FilterType = Enum.RaycastFilterType.Exclude
				Params.FilterDescendantsInstances = {Character}
				local Hitbox =
				Hitbox.RaycastParams = Params
				Hitbox:SetPoints(RightArm, {RightGripAttachment.Position})
				for Index, DmgPoint in pairs(HandHitboxDmgPoints:GetChildren()) do
					local Clone = DmgPoint:Clone()
					Clone.Parent = RightArm
					Hitbox:SetPoints(RightArm, {Clone.Position})
					Debris:AddItem(DmgPoint, 0.6)
				Hitbox.Visualizer = true
				Hitbox.OnHit:Connect(function(Hit, Humanoid)
					if #CharactersToAffect < 2 then
						table.insert(CharactersToAffect, Humanoid.Parent)
						local HitCharacter = Humanoid.Parent
						local HitPlayer = PlayerService:GetPlayerFromCharacter(HitCharacter)
						local HumanoidRootPart = HitCharacter:FindFirstChild("HumanoidRootPart")
						--HitCharacter.PrimaryPart = HumanoidRootPart
						local PushForce ="VectorForce")
						PushForce.Force = -RightGripAttachment.WorldCFrame.UpVector * 2000
						PushForce.Name = "PushForce"
						PushForce.Attachment0 = HumanoidRootPart:WaitForChild("RootAttachment")
						PushForce.Parent = HumanoidRootPart
						if HitPlayer then

This is a snippet that will trigger when an animation hits a certain keyframe
Nevermind I will just show you the whole thing because I realized the snippet is vague

1 Like

Haven’t gone into RayCastv4 or stuff yet, may you explain the api usage of :HitStart() and why do you have to put 0.6 as a param?

1 Like

HitStart() starts the hitbox detection, similar if you were to do Hitbox.Touched:Connect()

The parameter in the HitStart() method is a shortcut to make the hitbox turn off.
So instead of doing:


I can just do:

Hitbox:HitStart(0.6) -- Will disable after 0.6 seconds

Also responding to your Vectorforce question, I found vectorforce to be smoother as it takes some time to accelerate, although it doesn’t really matter because I set the force so high, there’s pretty much no acceleration.

Another thing is for all players and NPCs I set their character to be completely massless to make forces more effective/balanced for each character, maybe this has something to do with it?

1 Like

bump again…

Still not sure what the solution is and I feel like the solution for this should be more well known as lots of games have melee combat systems without a problem

1 Like