A conditional statement would allow you to accomplish this.
Presumably, you could create an algorithm such as this:
function Check_Gold()
Gold = 1;
Maximum_Number = 10;
if(Gold < Maximum_Num)then
Gold = Gold + 1; Increases the value if the variable "Gold" is lesser than the limit;
else
print("You have reached the gold limitation!");
Event:connect(Check_Gold); |