johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 12:47 AM |
I have a global function that I would like to be able to call my global function in both local, and nonlocal Scripts. I have made an Identical Copy of my nonlocal script that holds global functions, except for that it is local, so it can (hopefully) communicate to the localscripts.
My problem is, it doesn't seem like my scripts are running, and my conclusion is,
repeat wait() until _G.Ready
,that there is a problem with having the same Function defined twice, one local, and one nonlocal. Is that the problem? If it isn't, what is? If it is, what do I do to fix it? |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 12:48 AM |
| It does seem to be the problem, because when I removed the line, it continued with the script and stopped after it reached my other globalfunction. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 01:41 AM |
Update: It has nothing to do with the NonLocal script. My GlobalFunctions are in a LocalScript. Therefore they should work for other localscripts on that client, correct? My Localscripts will not get past my globalfunctions that are defined. There are no errors. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Aug 2013 04:17 AM |
| Are you sure the 'LocalScripts' are within a place they can run? |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 08:40 AM |
I have tried wait(1) at the start of my global function localscript. (It's in workspace) My other scripts work if i don't have global functions in them
|
|
|
| Report Abuse |
|
|
|
| 07 Aug 2013 08:48 AM |
| So since you have the global functions in a local script, you can test these global functions using the command bar in the studio (which is local itself). Try it and see if it can pick up those functions. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 08:53 AM |
_G.print("TextMessage", "Really red"):1: attempt to call field 'print' (a nil value) So the script isn't creating my global functions. How do I fix this? o.e |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Aug 2013 08:54 AM |
"I have tried wait(1) at the start of my global function localscript. (It's in workspace)"
LocalScripts do not run in Workspace. A LocalScript will only run when it's in one of the following places:
- PlayerGui - Backpack - Player's GUI
|
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Aug 2013 08:55 AM |
Player's Character*
Sorry, I believe my fingers died there for a moment. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 08:56 AM |
Oh, ok That would've been nice to know from the start >.< |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 08:58 AM |
| So, if I just toss it into my StarterGUI, they should work? |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Aug 2013 09:16 AM |
| Yes, it should then run as needed. |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 07 Aug 2013 09:18 AM |
Well, it isn't ._. Exact same error All of regular scripts work just fine with the NonLocal copy.
is wait(1) long enough for the localscript to start or watev? |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
| |
|