Function won't work

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

PokiPoscar

New Member
Oct 19, 2024
8
1
3
It says "The function "achiekills" does not exist" even tho i have a function thats named achiekills

The function:

Code:
function achieKills(p: player):
    send "%{Achie1kill::%uuid of {_p}%}%" to {_p}
    wait 1 tick
    open chest with 6 rows named "&dDræbte" to {_p}
    ## 1 kill
    set slot 0 of current inventory of {_p} to wooden sword named "&4Første Kill" with lore "&fDræb 1 en fange" and "&4%{spillerkills::%uuid of {_p}%}%/1 Dræbt" and "&a+50 Løn"
 
It says "The function "achiekills" does not exist" even tho i have a function thats named achiekills

The function:

Code:
function achieKills(p: player):
    send "%{Achie1kill::%uuid of {_p}%}%" to {_p}
    wait 1 tick
    open chest with 6 rows named "&dDræbte" to {_p}
    ## 1 kill
    set slot 0 of current inventory of {_p} to wooden sword named "&4Første Kill" with lore "&fDræb 1 en fange" and "&4%{spillerkills::%uuid of {_p}%}%/1 Dræbt" and "&a+50 Løn"
Hear me out.
did it say...

"The function "achiekills" does not exist!"
or
"The function "achieKills" does not exist!"

If it's the first one, you need to capitalize the K.
If it's the second one, you need to share the whole skript.
Also, next time you post here, please post the error, what you think is wrong with the skript (if appliable) and the WHOLE skript (either how you put it here or in a file).
Thanks.
 
Hear me out.
did it say...

"The function "achiekills" does not exist!"
or
"The function "achieKills" does not exist!"

If it's the first one, you need to capitalize the K.
If it's the second one, you need to share the whole skript.
Also, next time you post here, please post the error, what you think is wrong with the skript (if appliable) and the WHOLE skript (either how you put it here or in a file).
Thanks.
it said "The function "achieKills" does not exist"

Code:
command /vagt:
    permission: vagt
    trigger:
        wait 2 tick
        open chest with 5 rows named "&6Vagt" to player
        wait 1 tick
        set slot 0,1,2,3,4,5,6,7,8,36,37,38,39,40,41,42,43,44,9,18,27,17,26 and 35 of current inventory of player to black stained glass pane named "&b" with lore "&l"
        set slot 29 of current inventory of player to nether star named "&d&lAchievements" with lore "&fKlik her for at se achievements"



On inventory click:
    if inventory name of player's current inventory is "&6Vagt" or "&dAchievements" or "&dDræbte":
        cancel event
        if name of clicked item is "&d&lAchievements":
            if player has permission "vagt":
                wait 1 ticks
                achie(player)
        if name of clicked item is "&bDræbte":
            if player has permission "vagt":
                wait 1 ticks
                achieKills(player)

on death:
    if attacker has permission "vagt":
        add 1 to {AchieKill::%uuid of attacker%}

function achie(p: player):
    wait 1 tick
    open chest with 6 rows named "&dAchievements" to {_p}
    set slot 0,1,2,3,4,5,6,7,8,36,44,9,18,27,17,26,45,46,47,48,49,50,51,52,53 and 35 of current inventory of {_p} to black stained glass pane named "&b" with lore "&l"
    set slot 10 of current inventory of {_p} to diamond sword named "&bDræbte" with lore "&fSe achievements med at dræbe"
    set slot 11 of current inventory of {_p} to iron bars named "&7Jail" with lore "&fSe achievements med at Jaile"
    set slot 12 of current inventory of {_p} to compass named "&7Online Tid" with lore "&fSe achievements med at være online"
    set slot 13 of current inventory of {_p} to barrier named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"
    set slot 14 of current inventory of {_p} to barrier named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"

function achieKills(p: player):
    send "%{Achie1kill::%uuid of {_p}%}%" to {_p}
    wait 1 tick
    open chest with 6 rows named "&dDræbte" to {_p}
    ## 1 kill
    set slot 0 of current inventory of {_p} to wooden sword named "&4Første Kill" with lore "&fDræb 1 en fange" and "&4%{spillerkills::%uuid of {_p}%}%/1 Dræbt" and "&a+50 Løn"
 
Last edited:
Hey, the functions have to stay in your code at the top, otherwise they will not be recognized by the script.


If this explains your issue, please mark the topic as solved.


Code:
function achie(p: player):
  open chest with 1 row named "&dAchievements" to {_p}
  wait a tick
  loop 54 times:
    add 1 to {_slot}
    set slot ({_slot}-1) of {_p}'s current inventory to black stained glass pane named " "
  set slot 10 of current inventory of {_p} to diamond sword named "&bDræbte" with lore "&fSe achievements med at dræbe"
  set slot 11 of current inventory of {_p} to iron bars named "&7Jail" with lore "&fSe achievements med at Jaile"
  set slot 12 of current inventory of {_p} to compass named "&7Online Tid" with lore "&fSe achievements med at være online"
  set slot 13 of current inventory of {_p} to red stained glass pane named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"
  set slot 14 of current inventory of {_p} to red stained glass pane named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"

function achieKills(p: player):
  send "%{Achie1kill::%uuid of {_p}%}%" to {_p}
  wait 1 tick
  open chest with 6 rows named "&dDræbte" to {_p}
  ## 1 kill
  set slot 0 of current inventory of {_p} to wooden sword named "&4Første Kill" with lore "&fDræb 1 en fange" and "&4%{spillerkills::%uuid of {_p}%}%/1 Dræbt" and "&a+50 Løn"

On inventory click:
  if inventory name of player's current inventory is "&6Vagt" or "&dAchievements" or "&dDræbte":
    cancel event
    if name of clicked item is "&d&lAchievements":
      if player has permission "vagt":
        wait 1 ticks
        achie(player)
      if name of clicked item is "&bDræbte":
        if player has permission "vagt":
          wait 1 ticks
          achieKills(player)

on death:
  if attacker has permission "vagt":
    add 1 to {AchieKill::%uuid of attacker%}
 
I didn't added your command at the code. You have to add it yourself.

I added it here:

Code:
function achie(p: player):
  open chest with 1 row named "&dAchievements" to {_p}
  wait a tick
  loop 54 times:
    add 1 to {_slot}
    set slot ({_slot}-1) of {_p}'s current inventory to black stained glass pane named " "
  set slot 10 of current inventory of {_p} to diamond sword named "&bDræbte" with lore "&fSe achievements med at dræbe"
  set slot 11 of current inventory of {_p} to iron bars named "&7Jail" with lore "&fSe achievements med at Jaile"
  set slot 12 of current inventory of {_p} to compass named "&7Online Tid" with lore "&fSe achievements med at være online"
  set slot 13 of current inventory of {_p} to red stained glass pane named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"
  set slot 14 of current inventory of {_p} to red stained glass pane named "Kommer snart" with lore "Ved ikke hvad jeg ellers skal tilføje"

function achieKills(p: player):
  send "%{Achie1kill::%uuid of {_p}%}%" to {_p}
  wait 1 tick
  open chest with 6 rows named "&dDræbte" to {_p}
  ## 1 kill
  set slot 0 of {_p}'s current inventory to wooden sword named "&4Første Kill" with lore "&fDræb 1 en fange" and "&4%{spillerkills::%uuid of {_p}%}%/1 Dræbt" and "&a+50 Løn"
# command

command /vagt:
    permission: vagt
    trigger:
        open chest with 5 rows named "&6Vagt" to player
        wait 1 tick
        set {_slot} to -1
        loop 45 times:
            add 1 to {_slot}
            set slot {_slot} of player's current inventory to black stained glass pane named " "
        set slot 29 of current inventory of player to nether star named "&d&lAchievements" with lore "&fKlik her for at se achievements"


# events

On inventory click:
  if inventory name of player's current inventory is "&6Vagt" or "&dAchievements" or "&dDræbte":
    cancel event
    if name of clicked item is "&d&lAchievements":
      if player has permission "vagt":
        wait 1 ticks
        achie(player)
      if name of clicked item is "&bDræbte":
        if player has permission "vagt":
          wait 1 ticks
          achieKills(player)

on death:
  if attacker has permission "vagt":
    add 1 to {AchieKill::%uuid of attacker%}
 
i found out thats it the functions that is bugged or someting like that and when i create a function everything below it gets "deleted" so now i have no idea what to do