Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Roblox Lerping | Why this show a error "Argument 3 missing or nil"?

Asked by 4 years ago

Code:

local self = {}

function self:StartEnemy(source, enemy)
    local stats = require(game.ReplicatedStorage.Modules.Types.EnemyStats)


    stats = stats[enemy]

    local obj = game.ReplicatedStorage.Assets.Enemies[enemy]:Clone()
    obj.CFrame = source["StartingPoint"].CFrame

    for i=1,#source,1 do
        local scf = obj.CFrame
        for j=0,1,stats.Speed*0.002 do
            local target = source[i].CFrame.p+Vector3.new(0,obj.Position.Y-1161.438,0)
            print(target)
            print(source[i])
            obj.CFrame = scf:lerp{target,i}
            wait(0.01)
        end
    end
end


return self

Output:

-839.400085, 1163.56262, 455.549927
  Path
  16:57:58.552 - Argument 3 missing or nil
16:57:58.552 - Stack Begin
16:57:58.553 - Script 'ServerScriptService.Modules.Classes.Enemy.EnemyAI', Line 18 - method StartEnemy
16:57:58.554 - Script 'ServerScriptService.Scripts.Main', Line 11
16:57:58.554 - Stack End
0
Might be because you're sending a table as an argument on line 18. ScuffedAI 435 — 4y

Answer this question