i added the b's on the beggining coz title was too short. pretty simple but im not sure if i understand what it does. what i mean is something like this
1 | -- script |
2 | local abc |
3 | -- the rest of the script |
and nothing else
This is used so you can set the data of it afterward. E.g.
1 | --//Variables |
2 | local target |
This could be used as a turret or gun.
01 | --//Variables |
02 | local target |
03 |
04 | local bullet = game.ServerStorage.Bullet:Clone() |
05 | bullet.Touched:Connect( function (hit) |
06 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
07 | target = hit.Parent |
08 | else |
09 | target = nil |
10 | end |
11 | end ) |
You could use this technique later. E.g. You could make a textbox that shows what the target is
01 | --//Variables |
02 | local target |
03 |
04 | local bullet = game.ServerStorage.Bullet:Clone() |
05 | bullet.Touched:Connect( function (hit) |
06 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
07 | target = hit.Parent.Name |
08 | else |
09 | target = nil |
10 | end |
11 | end ) |
12 |
13 | local textBox = script.Parent |
14 | if target ~ = nil then |
15 | textBox.Text = target |
16 | else |
17 | textBox.Text = "No Target" |
18 | end |
So basically, the variable will hold the value nil
until it has a value and you can then call that variable later in the script.
It is just a placeholder for a value that does not exist yet.
All it is is a variable that you made with no value, but you can change the value of it in a function or an event later.