How to increase variables in scripts?

I want to increase variable max_badtemp in a script with 0.5.
I can’t get t to work. Any suggestions?

Please don’t post pictures of text. Post the properly formatted text.

Also variables are local to a script/automation. So the variable can’t be used outside the script.

Also you have variables declared twice.

Thanks, this is the changed code ( still not working).
Variable max_badtemp is defined in config (before scripts)

alias: Badtemperatuur ophogen

  • service: variable.set_variable
    variable: max_badtemp
    value: “{{ variable.max_badtemp + 1 }}”
    mode: single