I'm trying to make it so every time a player places a gray glazed terracotta (money generator), it gives them $1 every 5 seconds, I want that very specific placed block to be bound to the player, so when builders destroy gray glazed terracotta it doesn't send them a message, and also, for the $1 to be added only when the player is online.
This code I got seems to just crash the server when the player who placed the block goes offline.
This code I got seems to just crash the server when the player who placed the block goes offline.
Code:
on place:
set {_location} to event-location
if type of event-block is gray glazed terracotta:
set {generators::%{_location}%} to {_location} #save location
send "&6&l(!) &eTier I Generator has been placed!" to player
while player is online:
while block at {_location} is a gray glazed terracotta:
wait 5 seconds
add 1 to player's balance
else if type of event-block is air:
delete {generators::%{_location}%}
send "&6&l(!) &eTier I Generator has been removed" to event player