A really weird parry system

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…

1 Like

Could you provide some code so we can analyze if there is any yielding?

1 Like

How is this belongs to “code review” tag if there are no code? bruh

2 Likes

Send the code. We need code if we want to review it.

1 Like

sorry buddy, kinda new to this, i updated the post

my bad, kinda new to this thing lol…

I don’t think it’s full.

You should not be firing damage as a value from the client, as exploiters can fire them. You should also be checking things on the server and not the client, as exploiters will be able to spoof the values.

while true do
    stun = false
end

Exploiters can do something like that, if you check on a localscript.

As for the delay, I’d need to do more reviewing. This is just some of the exploitable parts of your script.

This can also be caused by ping, and/or/is client - server delay.

1 Like

it actually is full, i have no idea on how to make this better, and i made it on the client so the parry system would be consistent…about exploiters, im working on it already, but i just need to put a normal damage system togheter…

I don’t think the server script you provided is full. I mean…
image

1 Like

the parts which are out arent important, thats what i mean, sorry

RemoteEvent.OnServerEvent:Connect(function(player,Request,What1,What2,What3,What4,What5,What6)
	if Request == "TakeDamage" then
		Charhum.Health -= What1
	elseif Request == "ParryStun" then
		RemoteEvent:FireClient(Player,"HitStun",1.5,5,"HIG","Light")

	elseif Request == "PlaySound" then
		game.ReplicatedStorage.EffectsReplicatorEvent:FireAllClients("SoundSummon",What1,What2,What3,What4,What5,What6)

	elseif Request == "ParticleSummon" then
		game.ReplicatedStorage.EffectsReplicatorEvent:FireAllClients("ParticleSummon",What1,What2,What3,What4)

	elseif Request == "AuraSummon" then
		game.ReplicatedStorage.EffectsReplicatorEvent:FireAllClients("AuraSummon",player.Character,What2,What3,What4)
	elseif Request == "HeatMode" then
		if What1 == "True" then
			Character.Torso.HeatEffect.Enabled = true
			Character["Right Arm"].HeatEffect.Enabled = true
			Character["Left Arm"].HeatEffect.Enabled = true
			Character.Highlight.FillTransparency = 0.8
			Character.Highlight.OutlineTransparency = 0
		elseif What1 == "False" then
			Character.Torso.HeatEffect.Enabled = false
			Character["Right Arm"].HeatEffect.Enabled = false
			Character["Left Arm"].HeatEffect.Enabled = false
			Character.Highlight.FillTransparency = 1
			Character.Highlight.OutlineTransparency = 1
		end
	end
end)
2 Likes

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