Since after you put an end you can't use local what is the point
like for example
01 | local part = game.workspace.part |
02 | end |
03 |
04 | --cannot use anymore |
05 |
06 |
07 | --new script |
08 | part = game.workspace.part |
09 | end |
10 | part.BrickColor = BrickColor.new( "Lavender" ) |
11 | --I dont get why people use local in some of the scripts |
Here's a link to an page about Scopes Anyway's I don't remember all the reasons but here's an example why local variables might work better.
This works but however if I were to do this
1 | local Function Test() |
2 | local Test = "Test" |
3 | wait( 1 ) |
4 | end |
5 |
6 | local Function Test 2 () |
7 | local Test = "Test" |
8 | end |
But if I do this then Test get's replaced with Test2.
01 | local Function Test() |
02 | Test = "Test" |
03 | wait( 1 ) |
04 | print (Test) |
05 | end |
06 |
07 | local Function Test_ 2 () |
08 | Test = "Test2" |
09 | print (Test) |
10 | end |
Marked as Duplicate by RayCurse, Vulkarin, and User#19524
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?