Solved help with my 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!

jeff1231

Member
Mar 22, 2024
40
2
8
on earth :o
www.costco.com
so im trying to have the skript add a command block to a list with a name, nbt, lore and custom model data, the only problem is it says
"%{_model::%loop-number%}%" is not a number

AppleScript:
local function itemreset():
  delete {items::*}
    #names for gems
  set {_names::*} to "ENDER", "TOTEM", "LIFESTEAL", "INVISIBILITY", "SPEED", "STRENGTH", "LUCK", "STAR", "XP", "JUMP", "GODAPPLE", "ABSORPTION", "SPECTATOR" and "HEALTH"
    #lore for gems
  set {_lore::*} to "ENDER", "TOTEM", "LIFESTEAL", "INVISIBILITY", "SPEED", "STRENGTH", "LUCK", "STAR", "XP", "JUMP", "GODAPPLE", "ABSORPTION", "_SPECTATOR" and "_HEALTH"
    #model data
  set {_model::*} to "2011001", "2011002", "2011003", "2011004", "2011005", "2011006", "2011007", "2011008", "2011009", "2011010", "2011011", "2011012", "2011013" and "2011014"
   
  loop size of {_names::*} times:
    set {_d} to nbt compound from "{%{_names::%loop-number%}%:1b}"
    set {m} to "%{_model::%loop-number%}%"
    add command block named "&6%{_names::%loop-number%}% &6GEM" with nbt {_d} with lore "&6%{_lore::%loop-number%}%" with model data "%{_model::%loop-number%}%" to {items::*}

local function randogem(p: player):
  if any:
    {items::*} is not set
    size of {items::*} is 0
  then:
    kick {_p} due to "No available gems"
  else:
    set {_i} to random item out of {items::*}
    remove {_i} from {items::*}
    give {_p} 1 of {_i}

local function reroll(p: player):
  add {_p}'s held item to {items::*}
  remove {_p}'s held item from {_p}
  randogem({_p})

command gems_reset:
  permission: gems.reset
  trigger:
    if name of player is "SHAD0W11":
      itemreset()

command reroll:
  aliases: rr, roll
  permission: gems.reroll
  trigger:
    {reroll::%player's uuid%} < 0:
      send "&cYou've have no rerolls left!"
    else:
      name of player's tool contains " &6GEM":
        add -1 to {reroll::%player's uuid%}
        send "&6You have %{reroll::%player's uuid%}% rerolls left!"
        reroll(player)
      else:
        send "&cYou can't reroll if you aren't holding your gem!"

command gems_random:
  permission: gems.random
  trigger:
    set {reroll::%player's uuid%} to 3
    randogem(player)

command gems_check:
  permission: gems.check
  trigger:
    send "%{items::*}%"

command reroll_reset:
  permission: gems.reroll_reset
  trigger:
    set {reroll::%player's uuid%} to 0
    send "reset rerolls"

command reroll_admin:
  permission: gems.reroll_admin
  trigger:
    name of player's tool contains " &6GEM":
      add 1 to {reroll::%player's uuid%}
      reroll(player)
    else:
      send "&cYou can't reroll if you aren't holding your gem!"