** I want to make when the player has a boolvalue named blockAction they take no damage(I already did that). I want it when they don’t have the value in the player for that player to take damage. If the player not blocking the script breaks**
** I want to achieve making the player taking damage while blocking and not blocking. **
for i,v in pairs(game.Workspace:GetChildren()) do
local m = (v:IsA("Model") and v) or nil
if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Character then
if (Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= Range then
if Combo == 1 or Combo == 2 or Combo == 3 or Combo == 4 or Combo == 5 then
local EnemyHum = m:FindFirstChild("Humanoid")
local blockAction = m:FindFirstChild("Humanoid").blockAction
if EnemyHum then
if not blockAction then
print("Not block action")
local Damage = Player:WaitForChild("Damage")
m.Humanoid:TakeDamage(Damage.Value)
local x = Instance.new("StringValue", m:WaitForChild("Hit player's folder"))
x.Name = Player.Name
game.Debris:AddItem(x, 2)
else
if blockAction then
if blockAction.Value > 0 then
print("Is block Action")
blockAction.Value = blockAction.Value - 1
local NBlock = Block:Clone()
NBlock.CFrame = m:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,1,0)
NBlock.Parent = game.Workspace
game.Debris:AddItem(NBlock,0.5)
local Particle = NBlock.BodyFrontAttachment.Particle
Particle:Emit(15)
if blockAction.Value == 0 then
print("Block Break")
spawn(function()
local enemy = game:GetService("Players"):GetPlayerFromCharacter(m:WaitForChild("Humanoid").Parent)
if enemy then
local backpack = enemy:findFirstChild("Backpack")
if backpack then
local Melee = backpack:findFirstChild("Melee")
if Melee then
local isBroken = Melee.RemoteEvent.Script:findFirstChild("isBroken")
if isBroken then
isBroken.Value = true
print("isbroken")
wait(3)
isBroken.Value = false
end
end
end
end
end)
end
end
end
end
end
end