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: _G Scripts and LocalScripts

Previous Thread :: Next Thread 
johnhugh is not online. 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 is not online. 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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Aug 2013 02:19 AM
^^
Try adding waits
Report Abuse
Desperian is not online. 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 is not online. 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
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
07 Aug 2013 09:16 AM
Yes, it should then run as needed.
Report Abuse
johnhugh is not online. 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 is not online. johnhugh
Joined: 26 Mar 2009
Total Posts: 1971
07 Aug 2013 09:47 AM
got it to work :D
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