How to set the respawn location for a player?

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

pepper82

Member
Jan 26, 2017
272
1
18
Hi all,

I am making a minigame where players should respawn at a specific location once they died. I found that the teleport effect sometimes is not working (because of server lag? because of some other weird issue?) in the "on respawn" event. So what way would you recommend of setting a players respawn location and teleporting him there when he is in a minigame? Is it possible to temporarily change his default respawn location?
 
If I'd do it that way, the player would be able to take items out of a chest at his home and take them into the minigame / event. Because there may be a short delay between forcing respawn and teleporting.

Example:

Player dies in minigame
Player respawns at his respawn location at his home
He picks up items, or takes items ouf of a chest
He gets teleported into the minigame...
 
if you force them to respawn then teleport them it doesnt give them time to take items out of chest
 
Yeah but sometimes the teleport effect isn't executed when you do it like this:

force respawn player
teleport player to {location}

Don't ask me why, but I have so much trouble with teleport effect in skript. It sometimes just won't get fired for some weird reasons.
Also, sometimes there might be a lag / server lag in between these two effects (force respawn + teleport) and this is the moment a player COULD POSSIBLY take forbidden items into the minigame event.

It also may be that the player isn't ready to get teleported, yet when the "teleport" effect is fired. I did not come up with any working method of making sure a player gets teleported, yet.
 
Yeah but sometimes the teleport effect isn't executed when you do it like this:

force respawn player
teleport player to {location}

Don't ask me why, but I have so much trouble with teleport effect in skript. It sometimes just won't get fired for some weird reasons.
Also, sometimes there might be a lag / server lag in between these two effects (force respawn + teleport) and this is the moment a player COULD POSSIBLY take forbidden items into the minigame event.

It also may be that the player isn't ready to get teleported, yet when the "teleport" effect is fired. I did not come up with any working method of making sure a player gets teleported, yet.
theyll never even render the location where they respawn, they go straight into the loading screen for the teleport. If the teleport effect doesnt work you could you always execute the vanilla teleport command. Another option would be to prevent them from dying in the first place by checking on damage if the final damage is greater than the players health then cancel the event and send them where you want.
 
MundoSK has a respawn location expression which can be used like this:
code_language.skript:
on respawn:

    set respawn location to location(0, 4, 0, event-world)
Make sure to have the latest beta.
 
  • Like
Reactions: pepper82
Status
Not open for further replies.