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: Is this possible

Previous Thread :: Next Thread 
15cups is not online. 15cups
Joined: 22 Dec 2008
Total Posts: 155
28 Aug 2013 03:36 PM
I was wondering if it was possible to change a value within a different script. so say you have two scripts (labeled A and B), A a value named ONCE. The ONCE value is set to 10; script B completed its function and wants to change the ONCE value is in script A to 15. Is there a way to do this? i know i could use an intvalue but it would just be easier and less cluttered if this is possible.
Report Abuse
Stefan631 is not online. Stefan631
Joined: 23 Dec 2010
Total Posts: 1350
28 Aug 2013 03:42 PM
nope.avi
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
28 Aug 2013 03:46 PM
global functions only work between same types of scripts (server vs client)

first script:
ONCE = 10
function _G.changeONCE(val)
ONCE = val
end

second script:
_G.changeONCE(15)
Report Abuse
Ekkoh is not online. Ekkoh
Joined: 22 Oct 2012
Total Posts: 524
28 Aug 2013 04:03 PM
Or more simply...

-- Script 1
_G.ONCE = 10

-- Script 2
print(_G.ONCE)
> 10
_G.ONCE = 20
print(_G.ONCE)
> 20

"To sing when you live and to sing when you die" - George Ragan
Report Abuse
15cups is not online. 15cups
Joined: 22 Dec 2008
Total Posts: 155
29 Aug 2013 03:08 PM
just to make things clear, the _G makes it a global value for all scripts to use?
Report Abuse
electricpretzel0 is not online. electricpretzel0
Joined: 30 Sep 2008
Total Posts: 1278
29 Aug 2013 03:24 PM
yes
Report Abuse
electricpretzel0 is not online. electricpretzel0
Joined: 30 Sep 2008
Total Posts: 1278
29 Aug 2013 03:25 PM
ya
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