You'll have to show your full script... there is obviously something elsewhere in your script which is overriding your chance setting that is done in the if (< 3 or > 97) block...
There is no way it should have reset to 97% unless there is another code branch setting the chance somwhere.
Everything else seemed to run fine, other than right there. But here's my full thing:
basebet = balance / 1024
nextbet = basebet
chance = 97.2549
function dobet()
if (lastBet.Roll < 3.3 or lastBet.Roll > 96.7) then
chance = 49.1089
end
if !win then
nextbet = previousbet*2
else
nextbet = balance / 1024
chance = 97.2549
end
end