local attackCooldown = 1 local attackWindup = 0.5 local attackRange = 3 local attackDamage = 20
local char = script.Parent.Parent local hum = char:WaitForChild("humanoid") local originalWalkSpeed = hum.WalkSpeed
local canAttack = true
script.Parent.AttackRemote.Event:Connect(function(plrRoot))
if not canAttack then return end canAttack = false
hun.Walkspeed = 0.1
local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://7209529782" local playAnim = hum:LoadAnimation(anim) plrRoot:Play()
wait(attackWindup) local newDistance = (char.HumanoidRootPart.Position - -plrRoot.Position).magnitude if newDistance <= attackRange + 5 then
if plrRoot.parent.Player.isBlocking.Value == true then attackDamage *= 0.5 end plrRoot.Parent.Humanoid:takeDamage(attackDamage)
wait(attackCooldown) hum.WalkSpeen = orininalWalkSpeed canAttack = true
end
The error is very simple: On line 12, you added an extra closing bracket ) without closing it
All you have to do is remove the extra closing bracket on line 12. Also, you're also missing an end)
Let me know if you have more issues!
Fixed Code:
local attackCooldown = 1 local attackWindup = 0.5 local attackRange = 3 local attackDamage = 20 local char = script.Parent.Parent local hum = char:WaitForChild("humanoid") local originalWalkSpeed = hum.WalkSpeed local canAttack = true script.Parent.AttackRemote.Event:Connect(function(plrRoot) if not canAttack then return end canAttack = false hun.Walkspeed = 0.1 local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://7209529782" local playAnim = hum:LoadAnimation(anim) plrRoot:Play() wait(attackWindup) local newDistance = (char.HumanoidRootPart.Position - -plrRoot.Position).magnitude if newDistance <= attackRange + 5 then if plrRoot.parent.Player.isBlocking.Value == true then attackDamage *= 0.5 end plrRoot.Parent.Humanoid:takeDamage(attackDamage) wait(attackCooldown) hum.WalkSpeen = orininalWalkSpeed canAttack = true end end)