Block/Combat doesn't seem to work after a full combo

Currently I have been working on a block system and tried various different methods related to magnitude, but each time I begin to use the block system things being to fall out of place.

For one the Animation still works even if the variable that it is specificized to doesn’t work, and for the second issue I was show a clip instead of explaining it, then begin to explain it after the clip.

https://www.mediafire.com/view/1rixncax9h7wsl4/1080p-141370234.gif/file

Basically, I was in a vc with a friend of mine who constantly tested things for me, and he named out multiple bugs, but after the block was broken after the full combo he began spam clicking, the combat being unable to play. On top of this, the block wasn’t even negating damage whatsoever, so it was just there looking pretty.

local SSS = game:GetService("ServerScriptService")

local Dic = require(SSS:WaitForChild("DictonaryHandler"))

local CTHandler = require(SSS.CombatSent:WaitForChild("CombatHandler"))

local DMG = workspace:WaitForChild("BaseDamage")

local baseDmgVal = DMG.Value

local Players = game:GetService("Players")

local Blocking = Players:GetAttribute("Blocking")

local BlockHandler = {}

function BlockHandler.OffSetDamage(Player, Enemy)
	local Character = Player.Character
	local Hum = Character.Humanoid

	local HB = workspace:WaitForChild(Player.Name.."Combat")
	local AHB = HB:WaitForChild("Hitbox")
	
	for _,EnemyPlayer in pairs(workspace.LivingThings:GetChildren()) do
		if EnemyPlayer:FindFirstChild("HumanoidRootPart") and EnemyPlayer ~= Character then
		if (EnemyPlayer.HumanoidRootPart.Position-Character.HumanoidRootPart.Position).Magnitude <= 5 then
			print(EnemyPlayer)
				print(Character)
				

			if not Dic.find(Character, "Stunned") or Blocking == false then
					if EnemyPlayer.HumanoidRootPart.Position.Magntiude <= AHB.Position.Magnitude then
						print("We close")
						baseDmgVal = baseDmgVal/5
					else
						baseDmgVal = baseDmgVal					
					end
					break
				end
			end
		end
	end
end
return BlockHandler

Module ^

local UIS = game:GetService("UserInputService")

local RS = game:GetService("ReplicatedStorage")

local SSS = game:GetService("ServerScriptService")

local Block = RS.Block

local Release = RS.Release

local CTHandler = require(SSS.CombatSent.CombatHandler)

local BlockHandler = require(script.BlockHandler)

local DicHandler = require(SSS:WaitForChild("DictonaryHandler"))

local Players = game:GetService("Players")


if _G.BlockingValue == false and _G.CanAttack == true then
	return
end

Block.OnServerEvent:Connect(function(Player, Enemy)
	
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local HumRP = Character.HumanoidRootPart
	
	
	if not DicHandler.find(Character, "Stunned") and _G.CanAttack.Value == false and _G.BlockingValue.Value == false then
		
		_G.BlockingValue.Value = true
		print("Printed out uhhhh that yo u are blocking troll")
		
		BlockHandler.OffSetDamage(Player, Enemy)
		
		
	end
	 

	
end)
Release.OnServerEvent:Connect(function()
	
	_G.BlockingValue.Value = false
	
	
end)

Basically, I’m just trying to figure out how to even make the Block usable.

Fixing the formatting.

--MODULE

local SSS = game:GetService("ServerScriptService")
local Dic = require(SSS:WaitForChild("DictonaryHandler"))
local CTHandler = require(SSS.CombatSent:WaitForChild("CombatHandler"))
local DMG = workspace:WaitForChild("BaseDamage")
local baseDmgVal = DMG.Value
local Players = game:GetService("Players")
local Blocking = Players:GetAttribute("Blocking")
local BlockHandler = {}

function BlockHandler.OffSetDamage(Player, Enemy)
	local Character = Player.Character
	local Hum = Character.Humanoid
	local HB = workspace:WaitForChild(Player.Name.."Combat")
	local AHB = HB:WaitForChild("Hitbox")
	for _,EnemyPlayer in pairs(workspace.LivingThings:GetChildren()) do
		if EnemyPlayer:FindFirstChild("HumanoidRootPart") and EnemyPlayer ~= Character then
			if (EnemyPlayer.HumanoidRootPart.Position-Character.HumanoidRootPart.Position).Magnitude <= 5 then
				print(EnemyPlayer)
				print(Character)
				if not Dic.find(Character, "Stunned") or Blocking == false then
					if EnemyPlayer.HumanoidRootPart.Position.Magntiude <= AHB.Position.Magnitude then
						print("We close")
						baseDmgVal = baseDmgVal/5
					else
						baseDmgVal = baseDmgVal					
					end
					break
				end
			end
		end
	end
end

return BlockHandler
--SERVER

local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local SSS = game:GetService("ServerScriptService")
local Block = RS.Block
local Release = RS.Release
local CTHandler = require(SSS.CombatSent.CombatHandler)
local BlockHandler = require(script.BlockHandler)
local DicHandler = require(SSS:WaitForChild("DictonaryHandler"))
local Players = game:GetService("Players")

if _G.BlockingValue == false and _G.CanAttack == true then
	return
end

Block.OnServerEvent:Connect(function(Player, Enemy)
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local HumRP = Character.HumanoidRootPart
	if not DicHandler.find(Character, "Stunned") and _G.CanAttack.Value == false and _G.BlockingValue.Value == false then

		_G.BlockingValue.Value = true
		print("Printed out uhhhh that yo u are blocking troll")

		BlockHandler.OffSetDamage(Player, Enemy)


	end
end)

Release.OnServerEvent:Connect(function()
	_G.BlockingValue.Value = false
end)
1 Like