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 
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 02:57 PM
Can someone explain what they do. I tried the wiki but couldn't fine anything to useful.

Questions I also have:

Can LocalPlayer be used in them?

What are they used for?



#Code for i,v in pairs do (game.Players:GetChildren()) v:Kick('Your a noob!') end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
16 Apr 2016 03:00 PM
help with storing functions you want to use in multiple scripts. They can be used for anything.

--server script

local module = require(game.ServerStorage.Modules.MyModule)

module.Output("Hello,"Yo",2+3)

--module script

module = {}

module.Output = function(x,y,z)
print(x,y,z)
end

return module

Output:

Hello
Yo
5


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 03:02 PM
"local module = require(game.ServerStorage.Modules.MyModule)"

Are you locating the module script from this?
And also, like what type of functions can these store.



#Code for i,v in pairs do (game.Players:GetChildren()) v:Kick('Your a noob!') end
Report Abuse
ikiled is not online. ikiled
Joined: 15 Jun 2012
Total Posts: 575
16 Apr 2016 03:42 PM
OT: Your forum signature is wrong :P

its:

#Code for i,v in pairs(game.Players:GetChildren()) do v:Kick("You're a noob!") end

OR

#Code for i,v in next, game.Players:GetChildren()) do v:Kick("You're a noob!") end


swag | ikiled | scripter
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 03:52 PM
Ya i realized that like 5 minutes ago right when i was scripting a loop xD.



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('Your a noob!') end
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
16 Apr 2016 03:54 PM
I told you that a week ago...


- I now join LordRambo's Side.
Report Abuse
ikiled is not online. ikiled
Joined: 15 Jun 2012
Total Posts: 575
16 Apr 2016 03:56 PM
#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('You're a noob!') end

> just copy and paste that exact thing, it is still wrong lmao


swag | ikiled | scripter
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 03:59 PM
How is it still wrong..



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('Your a noob!') end
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
16 Apr 2016 04:19 PM
"you're" :)
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 04:19 PM
Oh lol.



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('You're a noob!') end
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Apr 2016 04:25 PM
It's hard to explain, but it allows you to use functions in different scripts?
Example, here is the first one I made. I am still learning ModuleScripts.

Modulescript:

local module = {}

function module.makepart(position, size, anchored, cancollide)
local part = Instance.new("Part", game.Workspace)
part.Position = position
part.Size = size
part.Anchored = anchored
part.CanCollide = cancollide
end

return module



scerverscript:

mpm = require(workspace.Game.Modules.MakePartModule)

mpm.makepart(1,1,1, 5,5,5, true, true)


basically, if I require the module (mpm = require thing) then I can use the module.

Since it's a module, you do function module.whateveryouwant

then, basically, I set parameters to size, position, cancollide, anchored, then I tell what the parameters are.

So, one I require the module, basically I can just do function .makepart in the module, and then fill in the parameters. So for the position, 1,1,1, size, 5,5,5, etc.


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 04:29 PM
Oh i see so this can be used on multiple parts and what not. Is the require necessary though or is it to prevent it from bugging. Also thank you, this gave me a strong understanding on module script and im going to track this forum incase.



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('You're a noob!') end
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Apr 2016 04:30 PM
Well, yes the require part is needed so the script knows what the heck your talking about lol :). Good luck on learning them! :)


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 04:31 PM
I have one last question, are they server or client sided? Where can they run from, workspace, replicatedstorage?



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('You're a noob!') end
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
16 Apr 2016 04:33 PM
I put my serverscript into ServerScriptService, and my module script in a folder in workspace. Just tested, putting a modulescript into ServerScriptService still works. Cheers! :P


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
16 Apr 2016 04:33 PM
What about replicatedstorage?



#Code for i,v in pairs (game.Players:GetChildren()) do v:Kick('You're a noob!') end
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