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 » Scripters
Home Search
 

Re: variables between script

Previous Thread :: Next Thread 
WilhelmP is not online. WilhelmP
Joined: 27 Aug 2014
Total Posts: 28
14 Feb 2017 09:48 AM
Hello!

This might be a stupid question but i can't fint the answer. Can you please tell me how to make variables that can be accesible from other scripts.

/wilhelm
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
14 Feb 2017 09:59 AM
_G.Variable = ""


~ Josh
Report Abuse
WilhelmP is not online. WilhelmP
Joined: 27 Aug 2014
Total Posts: 28
14 Feb 2017 10:01 AM
like this? # = 3 _G.Variable = ###
Report Abuse
WilhelmP is not online. WilhelmP
Joined: 27 Aug 2014
Total Posts: 28
14 Feb 2017 10:02 AM
a = 3 _G.Variable = "a"
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
14 Feb 2017 10:05 AM
_G.VariableName = "This is an example"

print(_G.VariableName)
> This is an example

_G.example = function(text)
print(text)
end

_G.example"Hello world"
> Hello world


~ Josh
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
14 Feb 2017 10:11 AM
Do you know what tables are?

_G is literally just a table, which is accessible from all scripts. Keep in mind that this will not work between localscripts and normal scripts, or at least it won't if you have filtering enabled.

wiki.roblox.com/index.php?title=Global_namespace/Basic_functions#G
Report Abuse
WilhelmP is not online. WilhelmP
Joined: 27 Aug 2014
Total Posts: 28
15 Feb 2017 09:32 AM
ok thanks :D
Report Abuse
WilhelmP is not online. WilhelmP
Joined: 27 Aug 2014
Total Posts: 28
15 Feb 2017 09:34 AM
does iw work between diffrent locanscripts?
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
15 Feb 2017 09:35 AM
Yes.


~ Josh
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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