|
| 29 Jan 2017 07:46 AM |
I'm making a blocking system with my sword and I have the sword block animation down, it's just refusing to protect the player who's blocking
This is part of the code in ServerScript, I have no errors:
local BlockBoolen = Character:FindFirstChild("Block") or Instance.new("BoolValue"); BlockBoolen.Name = "Block"; BlockBoolen.Parent = Character local BlockPercentage = 100 -- this will block 50% of damage intake when blocking
Tool.Activated:connect(function() local ClickDelta = tick() - LastClick if ClickDelta > SwingTime and (not BlockBoolen.Value) then LastClick = tick() HitHumanoids = {} if ClickDelta < SwingTime + ComboWindow then Combo = (Combo + 1) % 3 else Combo = 0 end if Player then local DamageFunction = Blade.Touched:connect(function(hit) if Equipped and Character and Humanoid and Humanoid.Health > 0 and tick() > LastClick and not hit:isDescendantOf(Character) then -- See if TK? local TargetHumanoid = hit.Parent:FindFirstChild("Humanoid") if TargetHumanoid and TargetHumanoid.Health > 0 and not HitHumanoids[TargetHumanoid]then HitHumanoids[TargetHumanoid] = true local BlockBoolenOther = TargetHumanoid.Parent:FindFirstChild("Block") if BlockBoolenOther then if BlockBoolenOther.Value == true then TargetHumanoid:TakeDamage((Damage * (Combo + 1)) * (BlockPercentage * 0.01)) else TargetHumanoid:TakeDamage(Damage * (Combo + 1)) end else TargetHumanoid:TakeDamage(Damage * (Combo + 1)) end end end end) |
|
|
| Report Abuse |
|