You can't restart the bot once you call stop(), the only way for it to start up again is to enter start() in the console window like you do to initially start the script running...
So, instead of issuing the stop() command, just track your profit amount, when it reaches the target you're happy with, use the invest() command and then reset back to initial script settings and continue
NOTE: I'm not sure if this will work with any site... I've never used the invest() command, but there seems to be invest() code for just-dice in the dicebot code, so I'm assuming it works ...
startBalance = balance
runProfit = 0
profitTarget = 1.0 -- Set this to how much PROFIT you want to make before you invest, not the balance!
....
function dobet()
runProfit = balance - startBalance
if (win) then
--do win stuff
else
-- do loss stuff
end
if runProfit >= profitTarget then
ching()
alarm()
print("Your Balance is " .. balance)
print()
print("TARGET ACHIEVED!!!")
print()
print("You Won " .. runProfit .. " for this Session")
print()
print("Investing: " .. runProfit)
invest(runProfit) -- invest winnings
-- reset back to beginning and continue
startBalance = balance
runProfit = 0
chance = 90
bethigh = true
nextbet = basebet
print(" ")
end
end