i made multiple guns then released that i had the same ammo for all of them so i made them local then it didnt work anymore.
code_language.skript:
on load:
{_max_ammo} = 30
{_ammo} = 30
on leftclick:
if name of player's held item is "&f&lDesert Eagle":
send action bar "Ammo left: %{_ammo}%" to player
if {_ammo} is greater than 1:
make the player shoot a arrow at speed 20
subtract 1 from {_ammo}
else:
send "DEBUG: NO AMMO" to player
send "DEBUG: AMMO VARIABLE: %{_ammo}%" to player
on rightclick:
if name of player's held item is "&f&lDesert Eagle":
add 15 to {_ammo}
send action bar "Ammo left: %{_ammo}%" to player
if {_ammo} is greater than {_maxammo}:
set {_ammo} to {_maxammo}
send action bar "Ammo left: %{_ammo}%" to player