How do I make a skript with two conditions?

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

cheesetheocto

New Member
Dec 4, 2023
7
0
1
23
I've been trying to make a heart adding skript with two conditions, but it just keeps getting errors. can somebody tel me what i'm doing wrong?

on rightclick:
if player's tool is nether star named "Heart"'s name is color red:
edit {_MHP} by 1
edit player's max health by {_MHP}
remove 1 nether star named "Heart" from player's inventory
message "now have %{_MHP}% hearts"
 
It looks like your code has a couple issues. Below I’ve attached a bug free version of your code with notes on lines I changed.

Code:
on right click:
   if player's tool is nether star named "&cHeart": # &c is the color code for red. Also, &4 is a darker red
      add 1 to player's max health # We don’t need an additional variable just yet if we’re just changing the player’s health
      set {_MHP} to player's max health # Here is an example of the proper use for a local variable
      remove 1 of event-item from player's inventory
      send "&aSuccess! You now have &c%{_MHP}% Hearts&a!" to player # This makes sure only the designated player sees the message