Creating ModuleScript using Instance.new causes issues

I do not know if this is intentional, but creating ModuleScript using Instance.new, creates no value. Here’s a screenshot of what I mean:

Wouldn’t it be better just to clone a module script?

That’s not how ModuleScripts are intended to be used. A ModuleScript should end with a return statement that returns a single value, usually a table, sometimes a function. Then you make that value available to other scripts using require.

All explained here ModuleScript | Roblox Creator Documentation

2 Likes

I literally said creating a ModuleScript with Instance.new is causing issues, why else do you think I said that??

1 Like

It would be… and I’m doing it right now, but having it work with Instance.new would be better.

Try doing

Instance.new("ModuleScript",game.ServerScriptService).Source = [[
local module = {}

return module
]]

A script’s source can’t be edited while in-game. Those permissions are only granted to plugins.

I mean, I don’t see use of it then, why are you doing this?

1 Like

I can’t tell you everything, but let’s just say I’m trying some anti-cheat…

Okay, whatever this “anti cheat” does , I’m pretty sure it’s inefficient and bypassable.

2 Likes

I’m not gonna argue with you because you don’t even know what it does or how it works :grinning_face_with_smiling_eyes:

Are you trying to make a bunch of duplicates to confuse exploiters or something?

1 Like

I still see no use of it, my brain is hurting when you said “anti-cheat”.

1 Like

That’s child’s play to defeat… think something better :expressionless:

Well you’ve got me stumped then.

1 Like

No problem, I am not asking you to use it

maybe just… leave it empty. Or just clone as @Winbloo suggested as I don’t see any other solution

Did you guys forget my question? I asked, Is this intentional or not?, not How do I fix this?. Please stick to the topic…

Yes this is intentional. New scripts are generated blank except when inserting them via Studio.

1 Like

I’m pretty sure it’s intentional as I just tested it now and it does the same thing.