So i'm making an AI script, and there's a function with an error inside of it.
It apparently says that Workspace.Enemy.AI:59: Expected '(', '{' or when parsing function call, got ':'
It's in line
local function walkTo(destination)
local path = getpath(destination)
for index, waypoint in pairs(path:GetWaypoints()) do
local target = findTarget()
if target then
print('Target found, going dark', target.Name)
attack(target)
break
else
print('Moving to the target')
humanoid:MoveTo(waypoint.Position)
humanoid:MoveToFinished:Wait()
end
end
end
It's at line 14 at the Wait(), anybody have an idea on how to fix that?

1 comment
'MoveToFinished' is not a method of Humanoid, but an RBXScriptSignal attribute. The syntax expected is: 'Humanoid.MoveToFinished:Wait()'