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

Attempted to call require with invalid argument(s). help?

Asked by 4 years ago

I know.. I know.. This is from SpooksHD but i tried hard and still can't fix it so I WILL NOT ASK FOR FULL SCRIPT, insted i will ask what i did wrong and how can i fix it.

 ??:??:??.??? - Attempted to call require with invalid argument(s).
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
    obj.Parent = workspace

    print(#source)
    print(stats.Speed)

    for i=1,#source,1 do
        print{i}
        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
0
could you tell us which line the error is on? Wafflecow321 457 — 4y

1 answer

Log in to vote
2
Answered by
Elixcore 1337 Moderation Voter
4 years ago

On the 4th line, where you set the 'stats' variable, you are trying to require using {} instead of ()

a proper example of require looks like this:

module = require(modulescript)

not like this

module = require{modulescript}
Ad

Answer this question