Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a global variable?

Asked by 4 years ago

For example: What if i had this code:

Local clickdetector = script.Parent.Clickdetector clickdetector.MouseClick:Connect(function() local newpart = game.Workspace.part end) -- Here it will underline "newpart" with a red. How would I make it not do that?

2 answers

Log in to vote
0
Answered by
Nckripted 580 Moderation Voter
4 years ago

To define a global variable, use shared:

shared.Money = 100

print(shared.Money)

Hope this helped!

0
oof it says it is a nil value Saficcio 0 — 4y
0
sorry Nckripted 580 — 4y
0
but you could use values like IntValue Nckripted 580 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I found it out my self XD

Answer this question