Lets say when a part is removed then the script inside that part will add currency to itself.
Like when the parent of the script which is the part , gets removed the script will add the currency to the player.
1 | -- Part getting removed |
2 |
3 | currency = currency + 1 |
4 |
5 | end |
01 | local Workspace = game.Workspace |
02 | local part = Workspace.Part |
03 |
04 | Workspace.ChildRemoved:Connect( function (child) |
05 |
06 | if child = = part then |
07 |
08 | currency = currency + 1 |
09 | end |
10 | end ) |
ChildRemoved
fires when a child of the object is removed and child
is the object that got removed