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

?I have problem with lerping its saying that is table but its a part

Asked by 5 years ago

code is

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
            print(source[i])
            obj.CFrame = scf:lerp{source[i],CFrame+Vector3.new(0,obj.Position.Y-1161.438,0)}
            wait(0.01)
        end
    end
end


return self

output is

  Path
  11:41:50.763 - ServerScriptService.Modules.Classes.Enemy.EnemyAI:16: bad argument #1 to '?' (Vector3 expected, got table)
11:41:50.764 - Stack Begin
11:41:50.765 - Script 'ServerScriptService.Modules.Classes.Enemy.EnemyAI', Line 16 - method StartEnemy
11:41:50.765 - Script 'ServerScriptService.Scripts.Main', Line 11
11:41:50.766 - Stack End
kamilk0192 applied edits to script EnemyAI
0
I fell like i've seen a tutorial about this code XD BashGuy10 384 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You are passing in a table on line 16 -- use ( and ) instead of { and }, respectively. Further, it should probably say source[i].CFrame instead of the comma you have there currently.

0
thanks kamilk0192 4 — 5y
Ad

Answer this question