Respawn at a certain place while dying in a region

Hello,

How would you script something like the following:

You can fight inside an area (the script giving/deleting the sword tool is already working, with touching a part at the edge of the area), but when you die inside that area, you respawn and teleport next to the stage.
In a more general case: How would you script something that respawns you in a certain spawn, when you die in a specific area?

Thank you in advance, and let me know if it is not 100% clear!

Boele009

1 Like

You can use Region3 to determine if a Vector3 Position is between 2 Vector3 Points.

You can connect a Humanoid.Died Event to a function to run when the Characters humanoid died.

For teleporting the player to a certain point when they die, you can either use teams, and different spawn points for a team. Or you can just manually change the characters HumanoidRootPart CFrame once they spawn.

2 Likes

So I could check if the player is in the area within the Humanoid.Died event, and then teleport the player back to the area?

1 Like

Yeah, listen for the Humanoid.Died Event, then get the position of the character on death, check if it falls within the region, then teleport the character back to a set location next spawn.

1 Like