I'm trying to create a small sword fighting area in my game, and I want it to be when you enter the area, it sets a new spawning location so when you die, it spawns you back at a certain location in the area but then when you leave the area, it sets your spawn location back to the main map which will be quite far away.
How am I able to do this?
I usually use CFrames for teleportations
Heres an Example
local plr = game.Players.PlayerAdded:Wait() local char = plr.Character or plr.CharacterAdded:Wait() local HumanoidRootPart = char:WaitForChild("HumanoidRootPart") local Teleport1 = workspace.Part1 local Teleport2 = workspace.Part2 local debounce = false Teleport1.Touched:Connect(function() if debounce == false then debounce = true HumanoidRootPart.CFrame = Teleport2.CFrame wait(4) debounce = false end end)