|
| 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
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
| |
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 17 Jan 2014 06:07 PM |
| but for some reason it doesnt update |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 06:08 PM |
| Really? It keeps returning nil for me. |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 17 Jan 2014 06:08 PM |
| i took tostring off and ['Value'] to Value |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 17 Jan 2014 06:17 PM |
no i used reg script + module
not cmdbar |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 06:20 PM |
| I guess the command bar doesn't work with them. Let me try a script.. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 17 Jan 2014 07:49 PM |
@sam
Are you sure? I returned an entire table with one. |
|
|
| Report Abuse |
|
|
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 |
|
|