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: Module scripts,

Previous Thread :: Next Thread 
Lem0nzzz is not online. Lem0nzzz
Joined: 01 Sep 2014
Total Posts: 521
30 Apr 2015 06:25 PM
Could someone explain to me the use of them, and maybe suggest me some tutorials that would help me guide my way through, so I'll learn more about them? I already read the wiki, not understanding the meaning.


~ I approve 4 hats instead of 3!!!
Report Abuse
Lem0nzzz is not online. Lem0nzzz
Joined: 01 Sep 2014
Total Posts: 521
30 Apr 2015 06:28 PM
What are module scripts, and what do you need them for? And how would you use one?


~ I approve 4 hats instead of 3!!!
Report Abuse
Eternalfireeater is not online. Eternalfireeater
Joined: 01 May 2011
Total Posts: 10027
30 Apr 2015 06:28 PM
--ModuleScript,Workspace,Name="StuffFunc"
function stuff(blah)
return blah
end

return stuff
--//

--Script,Workspace
stuff=require(workspace.StuffFunc)
print(stuff())
--//
Report Abuse
ThaneTheCreator is not online. ThaneTheCreator
Joined: 08 Apr 2009
Total Posts: 2182
30 Apr 2015 06:29 PM
Their useful if you want to create a less laggy gun, since the bullets are controlled via server script, and not local.

~who's awesome? you're awesome!
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
30 Apr 2015 06:29 PM
say you have this function in a module script:

function hi()
print("hi")
end

you have 10 scripts that need that function but it'll be too tedious to add, so what do you do?
module scripts allow you to define the function in one place and use it in any script
Report Abuse
Eternalfireeater is not online. Eternalfireeater
Joined: 01 May 2011
Total Posts: 10027
30 Apr 2015 06:29 PM
They're used so you don't have to type the same variables, functions, etc. in a bunch of different scripts.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
30 Apr 2015 06:30 PM
I use it for my CET/CEST clock, so when the summertime changes I don't have to update all my scripts, just one Module.
Report Abuse
ThaneTheCreator is not online. ThaneTheCreator
Joined: 08 Apr 2009
Total Posts: 2182
30 Apr 2015 06:30 PM
Yes that too, they also work with FilteringEnabled to prevent exploiters.

~who's awesome? you're awesome!
Report Abuse
97neko is not online. 97neko
Joined: 14 Sep 2014
Total Posts: 16159
30 Apr 2015 06:31 PM
MODULE SCRIPT:

local stuff = {}

stuff.Test = function(arg)
print(arg)
end

stuff.Test2 = function(arg)
print(arg..'2')
end

return stuff



OTHER SCRIPT:
local module = require(game.Workspace.ModuleScript)
module.Test('fart')
module.Test2('fart')



OUTPUT:

fart
fart2



"whos ruinable" -Codite
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Apr 2015 07:16 PM
"since the bullets are controlled via server script, and not local."
Wrong and misinformed.

"they also work with FilteringEnabled to prevent exploiters."
You could not be more wrong here.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
30 Apr 2015 07:19 PM
"Their useful if you want to create a less laggy gun, since the bullets are controlled via server script, and not local."

They add functions to the code you require it in, it isn't server unless you require with a server script.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
30 Apr 2015 07:20 PM
It's good for organization, and re-using code.
You could use _G and get nearly the same results.

But.

If you require() a ModuleScript on a machine, it always returns the same value for THAT machine. So if you say, have an Interpolation function in ReplicatedStorage; both Clients and the Server and require() this and use it. All one script, easy to edit.

I use it for the first sentence at the top of this post.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
30 Apr 2015 07:21 PM
both Clients and the Server (can) require()

Mistake, and I use it as well for this.
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