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

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

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

1 comment

0

I fell like i've seen a tutorial about this code XD

1 answer

✓ Accepted answer

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.

1 comment

0

thanks

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