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

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

Mfnaf

Member
Nov 28, 2022
2
0
1
23
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": )
qdYJp9W

[doublepost=1669653096,1669652805][/doublepost]Here is a better way of reading the code

Screenshot.png

[doublepost=1669653586][/doublepost]NVM I FOUND A FIX I had to do loop-player in line 6 and not just player
 
Use: if world of player is "[world]":

Example:

Code:
command world:
    trigger:
        if world of player is "MyClassicSurvival":
            give diamond to player
        else if world of player is not "MyClassicSurvival":
            heal player
 
Use: if world of player is "[world]":

Example:

Code:
command world:
    trigger:
        if world of player is "MyClassicSurvival":
            give diamond to player
        else if world of player is not "MyClassicSurvival":
            heal player

I have already fixed it but thank you
 
Status
Not open for further replies.