Solved Functions

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

iGniSs

Member
May 3, 2017
18
0
0
Hello,
I'm new at functions and I need help.

code_language.skript:
command /functions:
  trigger:
    openShopGui(player)
    stop

function openShopGui(p: player):
  open chest with 3 rows named "&c&lShop" to {_player}

Do nothing, command don't exist.
 
replace {_player} with {_p} unless you change "(p: player)" to "(player: player)" the first value is the local variable you will use in the function and the second one is the type of value you will input so you can make the first value anything you want but you have to remember to call it correctly, so if your function is "function openShopGui(data: player)" then to use that input in the function you would use {_data}. Maybe you already know this and simply overlooked it but I also wanted to inform you in case you didn't know. Also one last thing I believe the function code needs to be placed before any code that calls the function so instead of having your function below the command code you want to put it above, although I think it doesn't work like that anymore in the newer bensku versions of skript, so if you don't get any errors then discard that
 
You must put the function above the trigger. Load the function first, then the trigger.
 
Status
Not open for further replies.