Variables not saving after restart

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Tubl

Member
Sep 6, 2023
3
0
1
15
I was messing around with skript making random stuff and i realized when i restart my server the variables get reset to their default amount. Is there a way to fix this?
 
There are a many variables that are not saving, can you send the code?
 
Heres my code:
Also when i restart my server i get this error:
[16:24:10 ERROR]: #!#!
[16:24:10 ERROR]: #!#! ===!!!=== Skript variable load error ===!!!===
[16:24:10 ERROR]: #!#! Unable to load (all) variables:
[16:24:10 ERROR]: #!#! Cannot create the database file 'variables.csv': The system cannot find the path specified
[16:24:10 ERROR]: #!#!
[16:24:10 ERROR]: #!#! Skript will work properly, but old variables might not be available at all and new ones may or may not be saved until Skript is able to create a backup of the old file and/or is able to connect to the database (which requires a restart of Skript)!
[16:24:10 ERROR]: #!#!

Code:
variables:
    {smpname.killstreak.%player%} = 0
    {smpname.lives.%player%} = 3
on load:
    set {smpname::life} to diamond named "Life Item!"
    set {smpname::gemlvl5} to emerald named "5 Kills Gem"
    set {smpname::gemlvl10} to emerald named "10 Kills Gem"
    set {smpname::gemlvl15} to emerald named "15 Kills Gem"
    set {smpname::gemlvl20} to emerald named "20 Kills Gem"
on death of player:
    set {smpname.killstreak.%attacker%} to {smpname.killstreak.%attacker%}+1
    wait 3 ticks
    set {_random} to a random integer between 1 and 10
    if {_random} is 1:
        if attacker has potion resistance:
            set {_random} to a random integer between 2 and 8
            if {_random} is 2:
                apply strength 1 to attacker for 100 days
            if {_random} is 3:
                apply speed 2 to attacker for 100 days
            if {_random} is 4:
                apply haste 2 to attacker for 100 days
            if {_random} is 5:
                apply water breathing to attacker for 100 days
            if {_random} is 6:
                apply fire resistance to attacker for 100 days
            if {_random} is 7:
                apply health boost 2 to attacker for 100 days
            if {_random} is 8:
                apply regeneration 2 to attacker for 100 days
            set {smpname.killstreak.%victim%} to 0
            if {smpname.killstreak.%attacker%} is 5:
                give attacker {smpname::gemlvl5}
            else if {smpname.killstreak.%attacker%} is 10:
                give attacker {smpname::gemlvl10}
            else if {smpname.killstreak.%attacker%} is 15:
                give attacker {smpname::gemlvl15}
            else if {smpname.killstreak.%attacker%} is 20:
                give attacker {smpname::gemlvl20}
        else:
            apply resistance 1 to attacker for 100 days
    if {_random} is 2:
        if attacker has potion strength:
            set {_random} to a random integer between 2 and 8
            if {_random} is 2:
                apply resistance 1 to attacker for 100 days
            if {_random} is 3:
                apply speed 2 to attacker for 100 days
            if {_random} is 4:
                apply haste 2 to attacker for 100 days
            if {_random} is 5:
                apply water breathing to attacker for 100 days
            if {_random} is 6:
                apply fire resistance to attacker for 100 days
            if {_random} is 7:
                apply health boost 2 to attacker for 100 days
            if {_random} is 8:
                apply regeneration 2 to attacker for 100 days
            set {smpname.killstreak.%victim%} to 0
            if {smpname.killstreak.%attacker%} is 5:
                give attacker {smpname::gemlvl5}
            else if {smpname.killstreak.%attacker%} is 10:
                give attacker {smpname::gemlvl10}
            else if {smpname.killstreak.%attacker%} is 15:
                give attacker {smpname::gemlvl15}
            else if {smpname.killstreak.%attacker%} is 20:
                give attacker {smpname::gemlvl20}
            else:
                apply strength 1 to attacker for 100 days
    if {_random} is 3:
        if attacker has potion speed:
            (reroll)
        else:
            apply speed 2 to attacker for 100 days
    if {_random} is 4:
        if attacker has potion haste:
            (reroll)
        else:
            apply haste 2 to attacker for 100 days
    if {_random} is 5:
        if attacker has potion water breathing:
            (reroll)
        else:
            apply water breathing to attacker for 100 days
    if {_random} is 6:
        if attacker has potion fire resistance:
            (reroll)
        else:
            apply fire resistance to attacker for 100 days
    if {_random} is 7:
        if attacker has potion health boost:
            (reroll)
        else:
            apply health boost 2 to attacker for 100 days
    if {_random} is 8:
        if attacker has potion regeneration:
            (reroll)
        else:
            apply regeneration 2 to attacker for 100 days
    set {smpname.killstreak.%victim%} to 0
    if {smpname.killstreak.%attacker%} is 5:
        give attacker {smpname::gemlvl5}
    else if {smpname.killstreak.%attacker%} is 10:
        give attacker {smpname::gemlvl10}
    else if {smpname.killstreak.%attacker%} is 15:
        give attacker {smpname::gemlvl15}
    else if {smpname.killstreak.%attacker%} is 20:
        give attacker {smpname::gemlvl20}
    remove 1 from {smpname.lives.%victim%}
on right click:
    if player is holding {smpname::life}:
        add 1 to {smpname.lives.%player%}
        remove 1 of {smpname::life} from player's inventory
command /killstreak:
    aliases: /ks, /streak
    trigger:
        send "Your Kilstreak is Currently at %{smpname.killstreak.%player%}%!"
command /kssettest <number>:
    trigger:
        set {_temp} to arg-1
        set {smpname.killstreak.%player%} to {_temp}