Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I create a spawn for a certain area but when you leave it resets back to the main spawn?

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?

2 comments

0
0

I usually use CFrames for teleportation

1 answer

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)

1 comment

0

Where would I insert the script into?

This discussion is preserved as it was. New answers, comments, and votes are closed.