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
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.
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.
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
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