Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Aug 2016 03:39 PM |
or can i just run code thru it?
|
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 11 Aug 2016 03:42 PM |
| if you're requiring it, it has to return something. If you're only using it to run code you may as well use a serverscript or localscript. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 11 Aug 2016 03:45 PM |
you can run code within the module script and interect with the game like a normal script
returning just returns the the actual script so you can use it in game
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Aug 2016 03:46 PM |
trying to convert a script to a module so i can have it be a private
module, changing a 3000 line script and don't want to add returns if it isn't necessary
what does it have to return?
game.ReplicatedStorage.WowgnomesIsCool.OnServerEvent:connect(function(Player, first, second, third, fourth, fifth) print(first .. "sent") if first == "RPName" then --RP NAME print("Changing name to: "..second)
would ideally become require(player, first, second, third, fourth, fifth)
and i could just copy all the code over |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 11 Aug 2016 03:47 PM |
| have a giant function called main and return that |
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 11 Aug 2016 04:02 PM |
| An ideal module acts as a library of assets, values, & functions that can be universally utilized in the server and client in any type of game. If you don't return the module, the require function can't use any of it. Also, if you're using RemoteEvents and not manipulating them in some way to schedule/time their firing, I suggest using just normal scripts and LocalScripts. |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 11 Aug 2016 04:15 PM |
you dont have to make a giant function in the module
you can run code there and just return nil or something |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Aug 2016 04:20 PM |
catdawggnome = require(477785160) game.ReplicatedStorage.WowgnomesIsCool.OnServerEvent:connect(function(Player, first, second, third, fourth, fifth) print(first .. "sent") catdawggnome(Player, first, second, third, fourth, fifth) end)
it is saying, requested module experienced an error while loading |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Aug 2016 04:26 PM |
this is the asset https://www.roblox.com/MainModule-item?id=477785160
|
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 11 Aug 2016 04:28 PM |
| Do you have to -1,-2 the id for that asset? or idk |
|
|
| Report Abuse |
|
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Aug 2016 04:30 PM |
| note both the model and script are named MainModule |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 11 Aug 2016 04:37 PM |
| Yes ModuleScripts MUST return something. What it returns doesn't matter, nil works. |
|
|
| Report Abuse |
|
|