So basically I want to make a tower defence game, but one line always fails to work I'll point out in the script:
local self = {}
function self:StartEnemy(source, enemy) --Source is an array of our nodes that have been colltected by central script
local stats = require(game.ReplicatedStorage.Modules.Types.EnemyStats) -- Returns with what the module scipt orignal returend
stats = stats[enemy]
local obj = game.ReplicatedStorage.Assets.Enemies[enemy]:Clone() --Obj:Object (HERE)
obj.CFrame = source["StartingPoint"].CFrame
obj.Parent = workspace
print(#source)
for i= 1,#source,1 do
local scf = obj.CFrame
for j=0.1,stats.Speed*0.002 do
obj.CFrame = scf:lerp(source[i].CFrame+Vector3.new(0,obj.Position.Y.source[i].Position.Y,0,j))
wait(0.01)
end
end
end
return self
I don't know what's wrong I need help
