1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Function does not exist

Discussion in 'Skript' started by Mads Bille, Oct 28, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. Mads Bille

    Mads Bille Member

    Joined:
    Oct 15, 2018
    Messages:
    10
    Likes Received:
    0
    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 (Skript):
    1.  
    2. on rightclick:
    3.     if player is holding a diamond sword:
    4.         enchant(player, "123")
    5.  
    6.        
    7. function enchant(p:player, arg:text):
    8.     set {_uuid} to uuid of {_p}
    9.     if {_arg} is "123":
    10.         wait 1 tick
    11.         open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
    12.         format slot 0 of {_p} with white glass named " " with lore "" to be unstealable          
    13.         format slot 1 of {_p} with white glass named " " with lore "" to be unstealable          
    14.         format slot 2 of {_p} with white glass named " " with lore "" to be unstealable          
    15.         format slot 3 of {_p} with white glass named " " with lore "" to be unstealable          
    16.         format slot 4 of {_p} with white glass named " " with lore "" to be unstealable          
    17.         format slot 5 of {_p} with white glass named " " with lore "" to be unstealable          
    18.         format slot 6 of {_p} with white glass named " " with lore "" to be unstealable          
    19.         format slot 7 of {_p} with white glass named " " with lore "" to be unstealable          
    20.         format slot 8 of {_p} with white glass named " " with lore "" to be unstealable          
    21.         format slot 9 of {_p} with white glass named " " with lore "" to be unstealable          
    22.         format slot 17 of {_p} with white glass named " " with lore "" to be unstealable          
    23.         format slot 18 of {_p} with white glass named " " with lore "" to be unstealable          
    24.         format slot 19 of {_p} with white glass named " " with lore "" to be unstealable          
    25.         format slot 20 of {_p} with white glass named " " with lore "" to be unstealable          
    26.         format slot 21 of {_p} with white glass named " " with lore "" to be unstealable          
    27.         format slot 22 of {_p} with white glass named " " with lore "" to be unstealable          
    28.         format slot 23 of {_p} with white glass named " " with lore "" to be unstealable          
    29.         format slot 24 of {_p} with white glass named " " with lore "" to be unstealable          
    30.         format slot 25 of {_p} with white glass named " " with lore "" to be unstealable          
    31.         format slot 26 of {_p} with white glass named " " with lore "" to be unstealable    
     
  2. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
    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 (Skript):
    1. command /menu:
    2.       trigger:
    3.             funct(player)
    4.  
    5. function funct(p:player, arg:text):
    6.       set {_uuid} to uuid of {_p}
    7.       wait 1 tick
    8.       open chest with 6 rows named "&c&l SMED &e- {_p}" to {_p}
    9.       format slot 0 of {_p} with white glass named " " with lore "" to be unstealable        
    10.       format slot 1 of {_p} with white glass named " " with lore "" to be unstealable        
    11.       format slot 2 of {_p} with white glass named " " with lore "" to be unstealable        
    12.       format slot 3 of {_p} with white glass named " " with lore "" to be unstealable        
    13.       format slot 4 of {_p} with white glass named " " with lore "" to be unstealable        
    14.       format slot 5 of {_p} with white glass named " " with lore "" to be unstealable        
    15.       format slot 6 of {_p} with white glass named " " with lore "" to be unstealable        
    16.       format slot 7 of {_p} with white glass named " " with lore "" to be unstealable        
    17.       format slot 8 of {_p} with white glass named " " with lore "" to be unstealable        
    18.       format slot 9 of {_p} with white glass named " " with lore "" to be unstealable        
    19.       format slot 17 of {_p} with white glass named " " with lore "" to be unstealable        
    20.       format slot 18 of {_p} with white glass named " " with lore "" to be unstealable        
    21.       format slot 19 of {_p} with white glass named " " with lore "" to be unstealable        
    22.       format slot 20 of {_p} with white glass named " " with lore "" to be unstealable        
    23.       format slot 21 of {_p} with white glass named " " with lore "" to be unstealable        
    24.       format slot 22 of {_p} with white glass named " " with lore "" to be unstealable        
    25.       format slot 23 of {_p} with white glass named " " with lore "" to be unstealable        
    26.       format slot 24 of {_p} with white glass named " " with lore "" to be unstealable        
    27.       format slot 25 of {_p} with white glass named " " with lore "" to be unstealable        
    28.       format slot 26 of {_p} with white glass named " " with lore "" to be unstealable  
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    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!
     
    • Agree Agree x 1
  4. XanderWander

    XanderWander Member

    Joined:
    Jan 27, 2017
    Messages:
    71
    Likes Received:
    5
    Try putting the function on the top

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

    Dabriel Member

    Joined:
    Aug 13, 2018
    Messages:
    45
    Likes Received:
    5
    I tested this, it worked.

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

    XanderWander Member

    Joined:
    Jan 27, 2017
    Messages:
    71
    Likes Received:
    5
    Please mark as solved, ty
     
  7. Dabriel

    Dabriel Member

    Joined:
    Aug 13, 2018
    Messages:
    45
    Likes Received:
    5
    what? this isn't my thread.
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...