Started by
Kako
on
Topic category: Troubleshooting, bugs, and solutions
Hello, i'm trying to make a variable that gain +1 every time the player is being attacked, but it's only going to 1 and then if i get attack it's still at 1, here is a picture of the procedure :
The problem is that you're using a local variable. Local variables can only be used within a procedure, they're not permanent. Essentially, once the procedure is finished running, it deletes the variable and starts from zero.
What you want to do is go to your main workspace, and open the 'variables' tab on the left side. This lets you add global variables, which are permanent in a world's save file. You can make world variables, which are shared by all players, player-persistant variables, which are specific to each player, and player-lifetime variables, which are specific to each player and reset on death. You probably want that last one.
Thanks you so much, that worked perfectly !