Function does not exist

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

Mads Bille

Member
Oct 15, 2018
10
0
1
20
Hey, I can't find out what the problem is? When I reloaded the script it says in the chat "The function "enchant" does not exist" Can someone tell me why?

Here is the code I use

code_language.skript:
on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")

        
function enchant(p:player, arg:text):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable           
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
 
Hey, I can't find out what the problem is? When I reloaded the script it says in the chat "The function "enchant" does not exist" Can someone tell me why?

Here is the code I use

code_language.skript:
on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")

      
function enchant(p:player, arg:text):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
Skript version? Server version? Do you have any addons? The code works fine to me with Skript 2.2-dev37c (Server version 1.12.2)
EDIT: So change {_p} to %{_p}% at the "open chest with 6 rows with name "&c&l SMED &e- {_p} <. there...."""
And why you need this 123 string? Works fine without it
code_language.skript:
command /menu:
      trigger:
            funct(player)

function funct(p:player, arg:text):
      set {_uuid} to uuid of {_p}
      wait 1 tick
      open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
      format slot 0 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 1 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 2 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 3 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 4 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 5 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 6 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 7 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 8 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 9 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 17 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 18 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 19 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 20 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 21 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 22 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 23 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 24 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 25 of {_p} with white glass named " " with lore "" to be unstealable         
      format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
 
Hey, I can't find out what the problem is? When I reloaded the script it says in the chat "The function "enchant" does not exist" Can someone tell me why?

Here is the code I use

code_language.skript:
on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")

       
function enchant(p:player, arg:text):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable          
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
Based on your issue, my guess is you are using an older version of Skript, possibly 2.1.2 (by Njol)
The reason I suspect this, is the versions prior to Bensku's fork, functions need to be place BEFORE you call them in your Skript.
That is why you are getting the error saying the function doesn't exists, because technically it hasn't loaded yet, so it doesn't exists.
With Bensku's fork, functions can be placed anywhere in the skript, which is why some users on here have found it to work, because they're most likely using Benku's fork!
 
Try putting the function on the top

code_language.skript:
function enchant(p:player, arg:text):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable         
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable

on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")
 
I tested this, it worked.

code_language.skript:
function enchant(p: player, arg: string):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable       
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
 
on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")
 
I tested this, it worked.

code_language.skript:
function enchant(p: player, arg: string):
    set {_uuid} to uuid of {_p}
    if {_arg} is "123":
        wait 1 tick
        open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
        format slot 0 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 1 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 2 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 3 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 4 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 5 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 6 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 7 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 8 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 9 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 17 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 18 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 19 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 20 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 21 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 22 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 23 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 24 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 25 of {_p} with white glass named " " with lore "" to be unstealable      
        format slot 26 of {_p} with white glass named " " with lore "" to be unstealable
 
on rightclick:
    if player is holding a diamond sword:
        enchant(player, "123")

Please mark as solved, ty
 
Status
Not open for further replies.