Is it possible to cancle the death event and send the player to spawn?

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

Check in an on damage event if the final damage is equal or bigger than the player's health, if so cancel event and teleport the player. (perhaps u want to heal him aswell)
 
on damage:
if event-entity is a player:
set {_player's uuid} to id of event-entity
set {_current_health} to {_player's health.%{_player's uuid}%}
set {_final_damage} to event-damage
if {_final_damage} >= {_current_health}:
cancel event
teleport event-entity to spawn
set {_player's health.%{_player's uuid}%} to 100
heal the player

This will work?
Check in an on damage event if the final damage is equal or bigger than the player's health, if so cancel event and teleport the player. (perhaps u want to heal him aswell)
 
on damage:
if event-entity is a player:
set {_player's uuid} to id of event-entity
set {_current_health} to {_player's health.%{_player's uuid}%}
set {_final_damage} to event-damage
if {_final_damage} >= {_current_health}:
cancel event
teleport event-entity to spawn
set {_player's health.%{_player's uuid}%} to 100
heal the player

This will work?
code_language.skript:
on damage of player:
    final damage >= victim's health
    cancel event
    heal victim
    teleport victim to location(0,0,0)