Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a global variable?

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

To define a global variable, use shared:

shared.Money = 100

print(shared.Money)

Hope this helped!

3 comments

0

oof it says it is a nil value

0

sorry

0

but you could use values like IntValue

This discussion is preserved as it was. New answers, comments, and votes are closed.