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

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

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

1 comment

0

could you tell us which line the error is on?

1 answer

✓ Accepted answer

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}

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