generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: does a module script have to return code?

Previous Thread :: Next Thread 
Wowgnomes is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
0xDEADC0DE is not online. 0xDEADC0DE
Joined: 10 Apr 2016
Total Posts: 1039
11 Aug 2016 04:30 PM
lol ur too paranoid


Report Abuse
Wowgnomes is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image