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: New to module scripts need help

Previous Thread :: Next Thread 
GoldenCounty is not online. GoldenCounty
Joined: 07 Oct 2015
Total Posts: 1723
10 Mar 2017 04:42 PM
Can I put same code as scripts there or
Report Abuse
AxonMega is online. AxonMega
Joined: 29 Aug 2014
Total Posts: 2403
10 Mar 2017 04:44 PM
http://wiki.roblox.com/index.php?title=Intro_to_English
Report Abuse
Oryxide is not online. Oryxide
Joined: 09 Jul 2015
Total Posts: 647
10 Mar 2017 04:44 PM
https://youtu.be/T5V-IYCjK10?list=PLatbVFCcsDB8jgIzJ3a4_q6CeGnsD0rhf
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 04:45 PM
ModuleScripts won't run if the server is starting.

You can access them by Scripts or Localscripts to use functions out of them
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
10 Mar 2017 04:47 PM
Module scripts return a table of stuff to normal scripts, so no.
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:49 PM
Technically, you could. But why would you?
Report Abuse
GoldenCounty is not online. GoldenCounty
Joined: 07 Oct 2015
Total Posts: 1723
10 Mar 2017 04:49 PM
I knew the answer, just needed a checkup thanks
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:49 PM
@Intended You can use a ModuleScript just as # ############# it would just have to be required in # ############# Therefore it's useless.
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 04:50 PM
^ Roblox censorship at its finest
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
10 Mar 2017 04:51 PM
You still have to leave the module return stuff in it so no.
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:51 PM
I don't see why they block "Server Script", honestly.
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
10 Mar 2017 04:52 PM
Welcome to the wondrous world of whitelists.
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:55 PM
@Intended You can, it's just useless. As an example.

--Module Script

local module = {}
local Sound = Instance.new('Sound', game.Workspace)
Sound.SoundId = ('rbxassetid://636383865')
Sound:Play()
return module

--Server Script

loadstring(require(modulelocation))()
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:55 PM
Edit:

It does error, but either way. It still works.
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
10 Mar 2017 04:56 PM
You just proved what I wrote: You have to return something in a module script.
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 04:57 PM
^ Shouldn't be possible lol
Wiki:
Unlike other scripts, a module does not execute when a game starts
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:57 PM
Yes, but in reply to OP. It works, you just have to return something.
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 04:57 PM
^ Was for @OnceAlwaysFamous
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:59 PM
@maxi That is exactly why you have to require the module using loadstring in # #############
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 04:59 PM
The hashtags were "a Server Script" lol
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
10 Mar 2017 05:00 PM
you require a module like that:

local module = require(ID or the object in your game like game.ReplicatedStorage.Module)
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 05:02 PM
@maxi

Correct, but if you aren't calling a function or anything, that is useless. Otherwise just use it like this (even though it errors, it works). loadstring(require(game.ServerScriptService.ModuleScript))()
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
10 Mar 2017 05:07 PM
@Once

Something tells me you don't know what loadstring does.

Just stop.
Report Abuse
hasang1 is not online. hasang1
Joined: 09 Nov 2012
Total Posts: 903
10 Mar 2017 05:09 PM
@Once
You would only need to use loadstring if the ModuleScript returned a string.
If it returns a function, require(ID)()


HAX.
Report Abuse
OnceAlwaysFamous is not online. OnceAlwaysFamous
Joined: 07 Sep 2015
Total Posts: 135
10 Mar 2017 05:12 PM
@chim

Keep thinking that <3
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