it wont subtract from my variable?

  • 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 community!

    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!

Status
Not open for further replies.

iNeedhelp69

Member
Apr 27, 2021
1
0
1
code:

command /dmg <number>:
trigger:
remove arg-1 from {health::%player%}
wait 1 tick
send action bar "&c%{health::%player%}%&c/&c%{maxhealth::%player%}%&c❤" to player


issue: it doesnt subtract the arguement from my variable
 
You litterally typed the solution (kinda) in the title.

You need to use the following
Code:
subtract arg-1 from {health::%player%}

Instead of
Code:
remove arg-1 from {health::%player%}

"remove" is used when you want to remove something specific from a string.
"subtract" is used when you, well, want to subtract a integer/number from a variable.

E.g. say I have the variable "{some.variable}" and it's set to "5".

If I then do this, it will try and remove the number 1 from the variable, instead of subtracting 1 from the variable containing the integer "5", it will do nothing because the variable doesn't contain the integer "1".
Code:
remove 1 from {some.variable}


I hope this helped :emoji_slight_smile:
 
  • Like
Reactions: Aidan
Status
Not open for further replies.