Custom Enchantment

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

Status
Not open for further replies.

Thanqew

Member
Mar 12, 2022
1
0
1
Hi I tried to make a custom pickaxe enchantment but it just doesn't work. there are no errors. And i can open the gui and buy the enchant but the enchant doesn't lore and doesn't work. If anyone knows a fix i would be so happy cuz ive been trying for days

function openEnchantsMenu(p: player):
set metadata tag "enchantsMenu" of {_p} to chest inventory with 3 rows named "Custom Enchantments"
set slot (integers between 1 and 26) of metadata tag "enchantsMenu" of {_p} to gray stained glass pane
set slot 11 of metadata tag "enchantsMenu" of {_p} to tnt named "&cExplosive Enchant" with lore "&bCost: &2$10,000"
open (metadata tag "enchantsMenu" of {_p}) to {_p}

on right click:
openEnchantsMenu(player) if tool is any pickaxe

on inventory click:
if player's current inventory = (metadata tag "enchantsMenu" of player):
cancel event
if name of event-slot is "&cExplosive Enchant":
if player's balance >= 10000:
set {_} to tag "ExplosiveEnchant" of nbt of tool ? 0
if {_} <= 1000:
set tag "ExplosiveEnchant" of nbt of tool to ({_} + 1)
send "&aYou bought +1 level of Explosion!"
else:
send "&cSorry, but you are at the max level!"
else:
send "&cYou dont have enough money to buy this enchantment!"
set line 1 of lore of tool to "&cExplosive"

on mine:
if tag "ExplosiveEnchant" of nbt of tool is set:
set {_} to tag "ExplosiveEnchant" of nbt of tool
set {_chance} to random integer between 1 and 1000
if {_chance} is between 1 and ({_} parsed as integer):
loop all blocks in radius 3 of event-block:
give loop-block to player
set loop-block to air
 
Last edited:
Please use pastebin or use the "Insert code" feature because it's very hard to read the way it is now.
 
Status
Not open for further replies.