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 » Scripting Helpers
Home Search
 

Re: ModuleScript Table

Previous Thread :: Next Thread 
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 05:56 PM
points={};
points['RedTeam']=Workspace['GameScript']['RedPoints']['Value'];
points['BlueTeam']=Workspace['GameScript']['BluePoints']['Value'];
return points;

>print(tostring(require(Workspace.GameScript.GetPoints)['RedTeam']));
nil

Any reason why?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 05:58 PM
'['Value']'

rly
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 05:59 PM
Yes, really.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 06:04 PM
works for me
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 06:07 PM
but for some reason it doesnt update
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 06:08 PM
Really? It keeps returning nil for me.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 06:08 PM
i took tostring off and ['Value'] to Value
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 06:11 PM
You're testing this with a modulescript and trying to use require() from the command bar, correct? That's what I'm doing.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 06:17 PM
no i used reg script + module

not cmdbar
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 06:20 PM
I guess the command bar doesn't work with them. Let me try a script..
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 06:23 PM
So I just learned that ModuleScripts can't return an entire table. I guess I have no use for them.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
17 Jan 2014 06:24 PM
they cant?
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
17 Jan 2014 06:25 PM
First of all, you set that all up wrong.

Even if this did work, it would not update as the scores updated, as you took the Value at that one specific instant.

Try this:

--Workspace.GameScript.GetPoints (ModuleScript)
return {
function RedPoints()
return Workspace.GameScript.RedPoints.Value
end;
function BluePoints()
return Workspace.GameScript.BluePoints.Value
end;
}

--Elsewhere
print(require(Workspace.GameScript.GetPoints).RedPoints())


Try it in a Script or a LocalScript, not in the command bar.
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 07:45 PM
return {
function RedPoints()
return Workspace.GameScript.RedPoints.Value
end;
function BluePoints()
return Workspace.GameScript.BluePoints.Value
end;
}

Workspace.GameScript.GetPoints:2: '(' expected near 'RedPoints'

Also, like I said before, you can't return an entire table from a ModuleScript.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
17 Jan 2014 07:49 PM
@sam

Are you sure? I returned an entire table with one.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
17 Jan 2014 07:50 PM
I think sam is right the other day it wouldn't let me return the entire module.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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