Damage player touching block

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

ZsCortzones

Member
Feb 18, 2021
32
1
8
I have a skript where I'm trying to make a "mage wand" that casts fire particles in the direction it is shot in, and while i have that working, i want it to deal damage to any players while also burning those that get caught in it, and I can't quite figure out how to do it, can anyone help?

Code:
function line(loc1: location, loc2: location, particle: text):
    loop blocks between block at {_loc1} and block at {_loc2}:
        show ({_particle} parsed as visual effect) at location of loop-block


on right click with blaze rod:
    if {%player%_magecooldown} is false:
        set {%player%_magecooldown} to 0
    if {%player%_magecooldown} is true:
        set {%player%_magecooldown} to 0
    if {%player%_magecooldown} is not set:
        set {%player%_magecooldown} to 0
    else if {%player%_magecooldown} is not 0:
        send "&cPlease wait %{%player%_magecooldown}% seconds to use this again!" to player
    else if {%player%_magecooldown} is 0:
        line(location of player, location of targeted block, "mobspawner flames")
        loop all players:
            if loop-player is between {_loc1} and {_loc2}:
                damage loop-player by 2
        send " " to player
        send "&6&lMagic Used!" to player
        send " " to player
        set {%player%_magecooldown} to 15
        loop 15 times:
            wait 1 second
            remove 1 from {%player%_magecooldown}
        set {%player%_magecooldown} to 0
        send "&aYour magic is ready!" to player
 
im not entirely sure what you mean by this, can you elaborate?