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
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.