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.

Solved Problem with testing if the player is in the correct world

Discussion in 'Skript' started by Mfnaf, Nov 28, 2022.

  1. Mfnaf

    Mfnaf Member

    Joined:
    Nov 28, 2022
    Messages:
    2
    Likes Received:
    0
    I was making a script the last few minutes and was already running into a problem with testing in what world the player is in
    script:
    variables:
    {%player%.random} = true
    every 1 seconds:
    loop all players:
    if {%loop-player%.random} = true:
    if player is in world "randomItemFlat":
    give loop-player a random element of all items
    wait 1 tick
    command /togglerandomitems:
    trigger:
    if {%player%.random} = true:
    set {%player%.random} to false
    message "&8You have &cdisabled &8random items" to player
    else:
    set {%player%.random} to true
    message "&8You have &aenabled &8random items" to player

    it keeps giving me the error:
    There is no player in a periodical event line 6

    ( if player is in world "randomItemFlat": )[​IMG]
    --- Double Post Merged, Nov 28, 2022, Original Post Date: Nov 28, 2022 ---
    Here is a better way of reading the code

    Screenshot.png
    --- Double Post Merged, Nov 28, 2022 ---
    NVM I FOUND A FIX I had to do loop-player in line 6 and not just player
     
  2. gangula

    gangula Member

    Joined:
    Jul 28, 2021
    Messages:
    15
    Likes Received:
    0
    Use: if world of player is "[world]":

    Example:

    Code (Text):
    1. command world:
    2.     trigger:
    3.         if world of player is "MyClassicSurvival":
    4.             give diamond to player
    5.         else if world of player is not "MyClassicSurvival":
    6.             heal player
     
  3. Mfnaf

    Mfnaf Member

    Joined:
    Nov 28, 2022
    Messages:
    2
    Likes Received:
    0
    I have already fixed it but thank you
     
  4. gangula

    gangula Member

    Joined:
    Jul 28, 2021
    Messages:
    15
    Likes Received:
    0
    You're welcome :3
     

Share This Page

Loading...