Yo, i will go to the point, i have this parrying system which basically sets your defence value to 0, so when another player attacks you, its gonna check whats your defence, and if its 0 its gonna count as a parry, it currently works fine, but the problem is…its kinda delayed and sometimes the opposite of it.
the entire combat is on local script, and the damage calculations and especific effects are the only thing on server, which means its always using a remote, which i thought it wouldnt be delayed at all, but it is i think.
When the F key is pressed, the local script is gonna fire the remote with a parry request, when the server receives it, its gonna make so the player’s defence is set on 0, the problem is, i don’t know if thats the best way to do it, but it sure isnt, cause its laggy sometimes. The code works fine, but i just want a more responsive way of doing this without needing to rewrite my entire code…ill send the code if ya need it, i just want a less laggier way to do a parry…
anyway…This is the local script inside the combat folder.
CombatRemoteEvent.OnClientEvent:Connect(function(What1,What2,What3,What4,What5,What6)
MainGui.Event:Fire("HealthChanged")
if What1 == "HitStun" then
if CanBeStunned then
State = "Hit"
Character.Humanoid.WalkSpeed = 0
HeatChange(-1)
--
StunNumber += 1
local CurrentStunNumber = StunNumber
CombatRemoteEvent:FireServer("TakeDamage",What3)
AttackNumber = 0
BlockNumber = 0
ComboNumber = 1
--
local StunType = "STUN"..What4
if What4 ~= "None" then
StopAllAnimations(0)
AnimationTracks[StunType]:Play(0)
--
if What5 == "Light" then
ReplicateParticle(Assets.ParticleHolders.Hit,Character.Torso.Position,2)
PlaySound(HitSounds,1,1,2,Character.HumanoidRootPart,true)
elseif What5 == "Finisher" or "SKILL1" or "SKILL2" then
ReplicateParticle(Assets.ParticleHolders.HeavyHit,Character.Torso.Position,3)
PlaySound(HeavyHitSounds,1,1,2,Character.HumanoidRootPart,true)
elseif What5 == "SKILL3" then
ReplicateParticle(Assets.ParticleHolders.HeavyHit,Character.Torso.Position,3)
PlaySound(MaxHitSounds,1,1,2,Character.HumanoidRootPart,true)
end
end
--
task.wait(What2)
if What4 ~= "None" then
AnimationTracks[StunType]:Stop(0.3)
end
if CurrentStunNumber ~= StunNumber then return end
if not IsOnStance then
StunNumber = 0
State = "OutStance"
Character.Humanoid.WalkSpeed = 10
return end
--
StunNumber = 0
State = "OnStance"
Character.Humanoid.WalkSpeed = WalkSpeed
elseif not CanBeStunned and State == "Parrying" then
State = "OnStance"
What6.Character.CombatRemoteEvent:FireServer("ParryStun")
Character.Humanoid.WalkSpeed = WalkSpeed
BlockNumber += 1
HeatChange(What3)
--
ReplicateParticle(Assets.ParticleHolders.BlockHit,Character.Torso.Position,3)
PlaySound(HitSounds,1,0.6,2,Character.HumanoidRootPart,true)
--
CanBeStunned = true
StopAllAnimations(0)
CombatRemoteEvent:FireServer("AuraSummon",Player.Character,AuraColor3,1)
StunNumber = 0
AttackNumber = 0
ComboNumber = 1
end
--rest down here, it doesnt really matter...
and this one is a server script, which receives the signal with the damage, and does it on the server
RemoteEvent.OnServerEvent:Connect(function(player,Request,What1,What2,What3,What4,What5,What6)
if Request == "TakeDamage" then
Charhum.Health -= What1
well, it ain’t broken but it has like, half a second of delay, and i would like to remove or atleast decrease this.
sorry for not putting it here earlier, im kinda new to the forum…