How do I check if the player is in a region?

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

sourlemonzyt

New Member
Apr 19, 2020
5
0
0
38
so i have this skript here:
Code:
command /test69:
    trigger:
        message "success!"
and i would like to check if the player is in a world guard region called "test".
if this check returns true, it will run the message command. if the check returns false, it will
run a message command saying "failed". How would i go about doing this?

Little bit of background info this is my first time touching Skript. Please help me in a way that is
crystal clear for me to understand :emoji_grin:
Thank you!
 
Same here, I'm trying to let a skript work if the player is in a specific world guard region only. Can't seem to find a way...
 
try:
Code:
Trigger:
   if "%region at player%" contains "region_spawn"

region_spawn being the example name of the World Guard Region
 
try:
Code:
Trigger:
   if "%region at player%" contains "region_spawn"

region_spawn being the example name of the World Guard Region
Thank you for helping me, mate!

I revived an error message saying it cannot understand the condition/effect if "%region at player%" contains "region_test".

I also tried removing the "region" in the "region_test" section but i revived the same error message.

Am I supposed to use an add-on? Or am I doing something completely wrong?
 
Thank you for helping me, mate!

I revived an error message saying it cannot understand the condition/effect if "%region at player%" contains "region_test".

I also tried removing the "region" in the "region_test" section but i revived the same error message.

Am I supposed to use an add-on? Or am I doing something completely wrong?

"region_test" should be the exact same name of your world guard region as how it appears in the region list

if that isn't the case. Make a new region, in this case this one is called myregion and replace your code with
Code:
on command "/test69":
   if "%region at player%" contains "myregion":
      message "&e&lSUCCESS!"

Now a message should pop in chat after you do /test69 and are inside the myregion region
 
@sourlemonzyt @informerpuppy

For events:

Code:
on region enter:
    send "%region%" to player

Outside events: (U have to use regionS bc there could be multiple regionS on that location)

Code:
set {_rg::*} to regions at player
loop {_rg::*}:
    if loop-value = "test in world world":
        send "YES HE REGION JNSAASFJKFJJKASF"
        stop
 
it
"region_test" should be the exact same name of your world guard region as how it appears in the region list

if that isn't the case. Make a new region, in this case this one is called myregion and replace your code with
Code:
on command "/test69":
   if "%region at player%" contains "myregion":
      message "&e&lSUCCESS!"

Now a message should pop in chat after you do /test69 and are inside the myregion region
resulted with the same error :emoji_frowning:

i created a new region called myregion that stretched from the bedrock to build height! The error says that it cannot understand the expression!
[doublepost=1587391131,1587390876][/doublepost]
@sourlemonzyt @informerpuppy

For events:

Code:
on region enter:
    send "%region%" to player

Outside events: (U have to use regionS bc there could be multiple regionS on that location)

Code:
set {_rg::*} to regions at player
loop {_rg::*}:
    if loop-value = "test in world world":
        send "YES HE REGION JNSAASFJKFJJKASF"
        stop
so this is very difficult to understand. may you please explain a little bit? thank you for helping me!
 
it

resulted with the same error :emoji_frowning:

i created a new region called myregion that stretched from the bedrock to build height! The error says that it cannot understand the expression!
[doublepost=1587391131,1587390876][/doublepost]
so this is very difficult to understand. may you please explain a little bit? thank you for helping me!

Uhm wenn u try to retrieve the region of the player u use “region” but a player can be in multiple regions. So the syntax is not “region” but “regions”.

Only now it returns a list.
 
"region_test" should be the exact same name of your world guard region as how it appears in the region list

if that isn't the case. Make a new region, in this case this one is called myregion and replace your code with
Code:
on command "/test69":
   if "%region at player%" contains "myregion":
      message "&e&lSUCCESS!"

Now a message should pop in chat after you do /test69 and are inside the myregion region
hi. May you please tested the code for me? It does not seem to work on my server. Do I require a specific addon or anything? does it work with worldguard
 
Last edited:
Status
Not open for further replies.