I wrote the following short script but got the following error

LUA ERROR!!

'then' expected, got '='

Can someone fix this for me? I'm not a programmer and have zero experience LOL. Can't seems to find the problem?

The script basically bets with a 60% chance and double the bet on a lost but place the same amount bet after a win and after 7 losses in a row change the chance to 70%. It is also supposed to change the chance back to 60% after a double win on 70%

Thank you, I'll appreciate any help

This is the script I am trying to write;

bethigh = true

chance = 60

base = 0.00000002

nextbet = base

winafterloss = 0

function dobet()

if win then

if previousbet > base then winafterloss = 1

if winafterloss = 1 then nextbet = previousbet

if winafterloss = 0 then nextbet = base

if nextbet = base then chance = 60

else

winafterloss = 0

nextbet = previousbet * 2

if currentstreak > -7 then chance = 70

if currentstreak > -7 then nextbet = previousbet * 2.5

end

end