|
| 10 Sep 2012 11:03 PM |
Okay, first let me make an assumption. I assume that LocalScripts cannot access the _G table. I feel like I remember testing this a looong time ago, but I cannot remember.
So, assuming that's true, would it be possible to create an element inside _G, then have a LocalScript access that element via a BindableFunction object? For example:
func = script.Parent --inside BindableFunction
function func.onInvoke(key) return _G[key] end
Which would essentially retrieve the value of _G to a LocalScript, correct? Again, I haven't been on Roblox in several months, so I'm not up-to-date with all the changes probably made since, but this is what I remember, and would be useful in a project I have in mind. Correct me if I'm wrong. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 10 Sep 2012 11:09 PM |
When bindablefunction actually replicates (which it is set up to do, but last I tested it had not been implemented yet) yes, it will be possible to do that.
That doesn't make it a good idea though. You should only be performing abstract actions over the network with functions like that, for instance "reset the current level", not querying large pieces of data, which would be really slow. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2012 01:50 AM |
But the function that is binded to the object would execute in the LocalScript, so no. I tried this before to access data persistance from a LocalScript and it failed. |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 11 Sep 2012 04:10 AM |
| Why doesn't the >>>GLOBAL<<< table replicate to clients? |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2012 11:08 AM |
| I really should take a look at Bindable Functions, they look pretty interesting. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 11 Sep 2012 02:21 PM |
You can simply make a protocol that detects the type of the value to send, creates the appropiate Value object, assigns the value, sets the name to something to use as an identifier and place it inside a model somewhere. Then you could just use the ChildAdded signal to recieve requests and communicate like that. To prevent littering the DataModel in case of unexpected network errors, you could make the server sided script add things it sends to the Debris as a surefire way to add a timeout. |
|
|
| Report Abuse |
|
|