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: Passing variable through script to modulescript?

Previous Thread :: Next Thread 
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
31 Jan 2016 10:57 PM
--modulescript:
module = {}
pie = nil
return module

--script:
module.pie = 4



--print(module.pie)
> nil
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
31 Jan 2016 10:59 PM
you need to require the modulescript

-- ModuleScript:
local module = {};
module.pie = nil; -- not needed
return module;

-- Script:
local module = require(ModuleScript);
module.pie = 4;
print(module.pie);
Report Abuse
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
31 Jan 2016 11:07 PM
it is required, but still returns nil

might just insert an IntValue inside the modulescript
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
31 Jan 2016 11:20 PM
I just tested and it worked fine for me, is this your actually script or an example of what you are actually doing?
Report Abuse
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
31 Jan 2016 11:22 PM
I am printing from a localscript, and the modulescript is inside replicated storage.
The serverscript sets the variable to 4 in the modulescript depending on game time, but the localscript still prints out nil
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
31 Jan 2016 11:37 PM
ModuleScripts cache which is what makes this possible

But they cache separately on the server and on each client.
Report Abuse
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
31 Jan 2016 11:49 PM
I see. i guess i'll just use an intvalue
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
01 Feb 2016 01:27 AM
--modulescript:
module = {}
module.pie = nil
return module

--script:
module.pie = 4



Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
01 Feb 2016 01:28 AM
That wouldn't work for his purposes, we already solved the problem.
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