Air Combat System

I need help figuring out an issue with my air combat system.

I’m trying to implement a DownSlam in my combat PVP system using LinearVelocity. No matter what I do there seems to be a delay while using it. I’ve tried body velocity as well and still no luck. I’ve seen other youtube videos and games have it with minimal lag or delay, and I want to figure out how they do it.

Scroll to bottom to see code.

Here’s a video of another game having less delay than usual.

In my game: (ignore the bugs)

Code;

	if InAir then
						print("Attacked and In-Air")

						local attch = Instance.new("Attachment")
						attch.Parent = ehrp
						local bv = Instance.new("LinearVelocity")

						if ehrp:FindFirstChildWhichIsA("BodyPosition") then
							local bp = 	ehrp:FindFirstChildWhichIsA("BodyPosition")
							bv.Parent = ehrp
							bp:Destroy()
							bv.Attachment0 = attch
							bv.MaxForce = math.huge
							bv.VectorVelocity = Vector3.new(rp.CFrame.LookVector.X * 55 ,-30,rp.CFrame.LookVector.Z * 55)

							
							
						repeat wait(0.1)
							
						until
						ehum.FloorMaterial ~= Enum.Material.Air
						
						
						ragdoll.start(hit.Parent)
					
						end
					end

2 Likes

Just set the rigs assemblyVelocity to the desired velocity.

1 Like

What would the code look like?
enemyhrp.AssemblyLinearVelocity = Vector3.new(value,value,value)

1 Like

Yep! You could also tween it if you dont want sharp acceleration and deceleration.

2 Likes

I tried it, but there still appears to be some lag.


							ehrp.AssemblyLinearVelocity = Vector3.new(rp.CFrame.LookVector.X * 100 ,-20,rp.CFrame.LookVector.Z * 100)
1 Like

Is this server or client sided?

1 Like

I am setting the assembly on the server. Which is weird, since the dummy is also controlled on the server. So there shouldn’t really be lag

1 Like

At this point, I’m pretty sure it’s a roblox issue. But, I do want to know how other games made this groundslam feature.

1 Like

Could you just destroy the LinearVelocity once the player is back on the ground?

like this:

repeat wait(0.1)
until
ehum.FloorMaterial ~= Enum.Material.Air
bv:Destroy()
1 Like

Yeah, but that doesn’t fix the delayed lag in the air problem. I’m pretty sure it would stop the enemy from getting flung and ragdolled on the ground though.

1 Like

Oh, yes, sorry I read the post quite quickly and just assumed what the issue was.

I believe the way to fix this delay would be to move the “body moving” to the client instead of the server.

1 Like

Okay, I’ll try it. But wouldn’t it not make a difference, since the dummy is controlled on the server not the client despite lagging anyway? If it was a player it would make sense though.

Sorry If I’m wrong, not that experienced with network ownership and whatnot.

1 Like

Actually you have just made me realise, unless the sword damage system raycasts on the client, I think this would just mean that the player will be unable to damage the dummy from the position they see it in after the body moving.

I do think that moving the body moving to the client is the only solution for the delay, but it would also mean you’ll need to move the sword raycast/hitbox system to the client and use RemoteEvents to actually deal damage to the dummy.

I would advise testing if the body moving on the client removes the delay before making any changes to the sword system though of course :slight_smile:

1 Like

Here’s how I would do it:

I would rewrite Roblox’s decade-old replication system and use that instead, albeit I’ll have to use hacky workarounds and suffer from performance loss

1 Like

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