Could you give me some help? (About projectile)

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

Status
Not open for further replies.

Gina

Member
Aug 25, 2020
2
0
1
25
Skript ver: 2.4
Mincraft ver: 1.12.2

I was making a skript about gun which shoots stone button, but the effects when button hits the entity doesn't work and also reloading system doesn't work too. I need some feedback and help to fix my code.
Code:
On Load:
    set {ammo} to 20
    
command /gun:
    trigger:
        give 1 of paper named "&6gun" with lore "&fright click - shoot" to player
        
on right click:
    if name of player's tool contains "&6gun":
        if {ammo} is 0:
            wait 3 seconds
            set {ammo} to 20
        else:
            make player shoot an item projectile of stone button at speed 5
            wait 0.3 seconds
            reduce {ammo} by 1
            
on projectile hit:
    if event-projectile is stone button:
        damage entity by 3 hearts
        delete event-projectile
 
try that, i dont know if it will work but it might
Code:
on projectile hit:
    if event-projectile is stone button:
        damage victim by 3 hearts
        delete event-projectile

and for reloading use
Code:
on right click:
    if name of player's tool contains "&6gun":
        if {ammo} < 1:
            wait 3 seconds
            set {ammo} to 20
 
Status
Not open for further replies.