Help fix this for my gun skript

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

ANormalCoconut

New Member
Aug 1, 2022
8
0
1
15
If i fire m it will just summon infinite numbers of arrows all i wanted was a ammo cap to my gun so that it fires 15 then it will reload.
Code:
on right click:
    if player is holding a soul torch named "&3&lM":
        set {rplevel::%player%::*} to 0
        if {holdclick::%uuid of player%} is not set:
            set {holdclick::%uuid of player%} to 0
        while {holdclick::%uuid of  player%} < 1:
            shoot arrow at speed 4
            play sound "minecraft:block.amethyst_cluster.break" to player
            play sound "minecraft:block.amethyst_cluster.place" to player
            play sound "minecraft:block.amethyst_cluster.hit" to player
            play 20 flame 1 infront player's head
            add 1 to {rplevel::%player%::*}
        if {rplevel::%player%::*} >= 15:
            give player a stone named "&8&lReloading!"
            remove a soul torch named "&3&lM" from player
            play 20 lava pop at position of player to the player
            send "&5reloading" to player
            wait 10 seconds
            remove a stone named "&8&lReloading!" from player
            give player a soul torch named "&3&lM"
            player has 5 iron nugget
            remove 5 iron nugget from player
            wait 1 tick
            add 0.3 to {holdclick::%uuid of player%}
        if {holdclick::%uuid of player%} is not set:
            stop
            delete {holdclick::%uuid of player%}
        else:
            set {holdclick::%uuid of player%} to 0
on script load:
    delete {holdclick::*}
plz help
 
The problem probably is that every time on right click you set {rplevel::%player%::*} to 0, so it will never be more than 15. The second thing is, why do you use a list of you only set a variable. {rp::%player%} works fine, why make it a list?
 
idk why but i think i fixed without fixing it
Code:
on right click:
    if player is holding a soul torch named "&3&lM":
        if {_amount} = 15:
            player has 15 iron nugget
            remove 15 iron nugget from player
            give player a stone named "&8&lReloading!"
            remove a soul torch named "&3&lM" from player
            play 20 lava pop at position of player to the player
            send "&5reloading" to player
            wait 10 seconds
            remove a stone named "&8&lReloading!" from player
            give player a soul torch named "&3&lM"
            set {_amount} to 1
        else:
            shoot arrow at speed 4
            play sound "minecraft:block.amethyst_cluster.break" to player
            play sound "minecraft:block.amethyst_cluster.place" to player
            play sound "minecraft:block.amethyst_cluster.hit" to player
            play 20 flame 1 infront player's head
            add 1 to {_amount}
but it dosent reload the gun at 15
 
Last edited:
Status
Not open for further replies.