Skript issue with tp snowball

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

pXvel

Member
Feb 15, 2024
3
0
1
Hi so i've been wanting to make a skript that does this:

when a player hits another player with a snowball, both of them get teleported to a arena

the players both get tped back to a set of coordinates after 60 seconds

I also only want it to work in a region where pvp is enabled (specified bellow)

here's what i've came up with:

on projectile hit:
victim is a player
projectile is a snowball
shooter of the snowball is a player
set {_shooterWorld} to world of shooter of the snowball
set {_shooterLocation} to location of shooter of the snowball
set {_victimLocation} to location of shooter of the snowball
if {_shooterWorld} is "world":
if {_shooterLocation's x} is between -418 and -418:
if {_shooterLocation's y} is between 186 and 196:
if {_shooterLocation's z} is between 643 and 643:
if {_victimLocation's x} is between -418 and -418:
if {_victimLocation's y} is between 186 and 196:
if {_victimLocation's z} is between 643 and 643:
teleport shooter of the snowball to location -34, 182, 220
teleport victim to location -34, 182, 220
wait 5 seconds
teleport shooter of the snowball to location -146, 126, 639
teleport victim to location -146, 126, 639


Skript doesnt show any errors and the World, and coordinates seem to be fine after a bit of debugging, i also tried this:

on projectile hit:
victim is a player
projectile is a snowball
shooter of the snowball is a player
set {_shooterWorld} to world of shooter of the snowball
set {_shooterLocation} to location of shooter of the snowball
if {_shooterWorld} is "world":
if {_shooterLocation's x} is between -445 and -20:
if {_shooterLocation's y} is between 217 and 119:
if {_shooterLocation's z} is between 644 and 389:
teleport shooter of the snowball to location -34, 182, 220
teleport victim to location -34, 182, 220
wait 5 seconds
teleport shooter of the snowball to location -146, 126, 639
teleport victim to location -146, 126, 639

If anyone knows why and has the time to answer i'd be so relieved thanks!
 
ok guys i fixed it here's the final version

  1. on projectile hit:
    victim is a player
    projectile is a snowball
    shooter is a player
    if shooter's location is within location(-445,217,644,world) and location(-20,119,389,world):
    if victim's location is within location(-445,217,644,world) and location(-20,119,389,world):
    teleport shooter of the snowball to location -34, 182, 220
    teleport victim to location -34, 182, 220
    wait 5 seconds
    teleport shooter to location -146, 126, 639
    teleport victim to location -146, 126, 639

    Thanks to the people in the discord, life savers man I could not have had done anything without them.