I'm trying to run a require code through a RemoteEvent however when I run the code the error says

attempt to require a non-ModuleScript

local name = 'PlayerName'
local code = require(ID)('\"' .. name .. '\"')
print(code)
for i, v in pairs([LOCATION OF REMOTE]:GetChildren()) do
	if v.ClassName == 'RemoteEvent' then 
	v:FireServer(code,'KEY TO FIRE REMOTE')
	else
	print("couldn't find remote")
	end
  end
remote.OnServerEvent:Connect(function(plr,code,key)
		if key == 'KEY' then
		local Loadstring = require(remote:FindFirstChild('Loadstring'))
	Loadstring(code)()
	end
	end)

3 comments

1

require can only be called on a ModuleScript

0

Yes, I know its going to require a Module from the server.

0

It won't just return "attempt to require a non-ModuleScript for no reason, you are not requiring a module script. Double check anythin thats added with the same name.