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: Let's talk about Modules

Previous Thread :: Next Thread 
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
13 May 2015 12:58 AM
I'd like to open up a discussion to thouroughly give your ideas and thoughts on Module Scripts.

Some ideas to write about: What have you done with them, how do you use them in your games/testing, module script security, connection between client and server.
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
13 May 2015 01:23 AM
I guess I'll start...

I use Modules to grant me secure acess with HttpService by nuking the environment and keeping my code hidden from clients.

I've also used Modules like regular scripts, you call on them and they respond quite well.
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
13 May 2015 01:41 AM
I personally have no real idea what they do or what they're for. I shall be monitoring this thread in hopes to learn.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
13 May 2015 01:44 AM
Normally just use modules as a replacement to the Global Table.

Le ~ _G
Report Abuse
udayk8139 is not online. udayk8139
Joined: 25 Aug 2013
Total Posts: 622
13 May 2015 01:55 AM
I use them to store data.
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
13 May 2015 02:01 AM
I use them for a Special Round System in my game.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
13 May 2015 02:26 AM
I use ModuleScripts for Valkyrie
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
13 May 2015 11:29 AM
Alright

The goal of this thread is to expand module understanding and debate what is possible inside a module
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
13 May 2015 11:56 AM
I made a couple of cool APIs:

Explosion API:
http://www.roblox.com/Custom-Explosion-API-item?id=233652523

Asset/PreLoading API:
http://www.roblox.com/Asset-Pre-Loading-API-item?id=242932455
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
13 May 2015 12:29 PM
I tend to create little frameworks for projects with ModuleScripts. I've also done a few wrappers, this being the only actual released one:
http://www.roblox.com/--item?id=240640028

I use them with everything now though.. It just feels nicer to have a separate script storing all the important things, while there's another one dependant on it.
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
13 May 2015 12:32 PM
Only a ModuleScript may contain Paragon.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
13 May 2015 12:52 PM
I don't.

"I like to program" - Bosswalrus
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
13 May 2015 12:57 PM
Earlier today I tested a few things with ModuleScripts. I found out that the ModuleScript keeps its own environment rather than taking on the environment of the script that required it. I also found out that (rather obviously) a ModuleScript will run from the same side as the requiring script. So if you required a ModuleScript that is sitting in Workspace from a LocalScript in a Backpack somewhere, the ModuleScript will have access to the mouse and LocalPlayer.
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
13 May 2015 01:00 PM
I'm using a ModuleScript for my Framework I'm developing as well.

I really like ModuleScripts as they can just clean up your code, make you code easier and tons more.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
13 May 2015 01:01 PM
"ModuleScript keeps its own environment rather than taking on the environment of the script that required it"
Yeah, that's why I often return functions in my modules. Then I can do getfenv(2) and get the location of the script that requires it.
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
13 May 2015 04:33 PM
If you send it things in its arguments such as a player's mouse, etc, it can handle them. it just takes a localscript to grab 'em.

e.g:

--ModuleScript code:

keyHandler = {}

keyHandler.HandleNewPlayer = function(player, mouse)
print(player.Name.." being handled")
mouse.KeyDown:connect(function(k)
k=string.lower(k)
if k == "a" then
--etc
end
end)
player.leaderstats.Points.Changed:connect(function()
player.PlayerGui.Ding:Play()
end)
end

return keyHandler


--Local script:
wait(1)
plr = game.Players.LocalPlayer
m = plr:GetMouse
handler = require(game.ServerScriptStorage.HandlerModuleScript)

handler.HandleNewPlayer(plr, m)
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
13 May 2015 04:34 PM
* plr:GetMouse()

durr
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
13 May 2015 04:42 PM
-- module --

local mouse = game.Players.LocalPlayer:GetMouse()

local thing = function()
mouse.KeyDown:connect(function(key)
print("Using the mouse for input is depreciated, instead use UserInputService")
end)
end

return thing

-- --


-- local script --

require(module)()

-- --


I script -~ chimmihc
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
13 May 2015 04:48 PM
UserInputService gives me the creeps. That and the new playerscripts make me feel icky.
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