Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Workspace.Dummy.Controller.Attack:12: Expected identifier when parsing expression, got ')'?

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

1 answer

✓ Accepted answer

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!

##~JesseSong

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.