How Would I Make A Player Spawn Back Into The Same Exact Model

Hey, so I have a model, and when there are a certain amount of players it gets cloned and the players get teleported to spawn points inside of the model. Inside the model there are a bunch of obstacles and when the player dies I want them to spawn back in the same model at a spawn point. I don’t know how to make them spawn back in the same model and not a different one because there will be multiple of the same models, as the model will keep cloning as more players join. Sorry if I didn’t explain this very well.

Script that teleports the players to the model

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ServerStorage = game:GetService("ServerStorage")

local Arena = ServerStorage:WaitForChild("Arena")

local plots = ServerStorage:WaitForChild("VaultPlots"):GetChildren()

while true do
	
	local full = false
	
	local waiting = {}
	local plrs = {}
	
game.ReplicatedStorage.AddPlayerToTable.OnServerEvent:Connect(function(player)
		if full == true then
			table.insert(waiting,player)
		else	
			table.insert(plrs,player)
		end
end)
	
	if full == false then
		for i, player in pairs(waiting) do
			table.insert(plrs,player)
			table.remove(waiting,player)
		end
	end	
	repeat wait(1) until #plrs == 1
	
	full = true
	

	
	for i, plot in ipairs(plots) do 
		if plot.Bool.Value == false then

			position = plot.CFrame
			plot.Bool.Value = true
			break
		end
	end
	
	
	local ClonedArena = Arena:Clone()
	ClonedArena.Parent = workspace
	ClonedArena.PrimaryPart = ClonedArena.ArenaGround
	ClonedArena:SetPrimaryPartCFrame(position)
	ClonedArena.Status.Value  = true
	
	local SpawnPoints = ClonedArena:FindFirstChild("SpawnPoints")
	
	local AvailableSpawnPoints = SpawnPoints:GetChildren()
	
	for i, player in pairs(plrs) do
		if player then
			character = player.Character
			
			if character then
				
				character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
				table.remove(AvailableSpawnPoints,1)
				table.remove(plrs, i)
				
				game.ReplicatedStorage.WaitScreenEnd:FireClient(player)

			end
		end
	end
	
	if #plrs == 3 then
		for i, player in pairs(plrs) do
			if player then 
				character = player.Character
				
				if character then
					
					character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
					table.remove(AvailableSpawnPoints,1)
					table.remove(plrs,i)
					i -= 1
					game.ReplicatedStorage.WaitScreenEnd:FireClient(player)
				end
				
			end
		end
	end
	
	if #plrs == 1 then
		for i, player in pairs(plrs) do
			if player then 
				character = player.Character
				
				if character then
					
					character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
					table.remove(AvailableSpawnPoints,1)
					table.remove(plrs,i)
					i -= 1
					game.ReplicatedStorage.WaitScreenEnd:FireClient(player)
				end
				
			end
		end
	end
	
	
	full = false
	
end

Please send the script so I can see what I’m working with.

1 Like

Oh I kind of get it do when they get cloned a boolvalue becomes true and do if the boolvalue is true they get teleported to the model

I already have it so they get teleported to the model. Everything else works fine I just don’t know how to make it so they spawn back at that same model and not another clone of it.

You could do once they get cloned into your specific model the name changes to like Model2 instead of model1

This is the script that teleports the players to the model

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ServerStorage = game:GetService("ServerStorage")

local Arena = ServerStorage:WaitForChild("Arena")

local plots = ServerStorage:WaitForChild("VaultPlots"):GetChildren()

while true do
	
	local full = false
	
	local waiting = {}
	local plrs = {}
	
game.ReplicatedStorage.AddPlayerToTable.OnServerEvent:Connect(function(player)
		if full == true then
			table.insert(waiting,player)
		else	
			table.insert(plrs,player)
		end
end)
	
	if full == false then
		for i, player in pairs(waiting) do
			table.insert(plrs,player)
			table.remove(waiting,player)
		end
	end	
	repeat wait(1) until #plrs == 1
	
	full = true
	

	
	for i, plot in ipairs(plots) do 
		if plot.Bool.Value == false then

			position = plot.CFrame
			plot.Bool.Value = true
			break
		end
	end
	
	
	local ClonedArena = Arena:Clone()
	ClonedArena.Parent = workspace
	ClonedArena.PrimaryPart = ClonedArena.ArenaGround
	ClonedArena:SetPrimaryPartCFrame(position)
	ClonedArena.Status.Value  = true
	
	local SpawnPoints = ClonedArena:FindFirstChild("SpawnPoints")
	
	local AvailableSpawnPoints = SpawnPoints:GetChildren()
	
	for i, player in pairs(plrs) do
		if player then
			character = player.Character
			
			if character then
				
				character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
				table.remove(AvailableSpawnPoints,1)
				table.remove(plrs, i)
				
				game.ReplicatedStorage.WaitScreenEnd:FireClient(player)

			end
		end
	end
	
	if #plrs == 3 then
		for i, player in pairs(plrs) do
			if player then 
				character = player.Character
				
				if character then
					
					character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
					table.remove(AvailableSpawnPoints,1)
					table.remove(plrs,i)
					i -= 1
					game.ReplicatedStorage.WaitScreenEnd:FireClient(player)
				end
				
			end
		end
	end
	
	if #plrs == 1 then
		for i, player in pairs(plrs) do
			if player then 
				character = player.Character
				
				if character then
					
					character.HumanoidRootPart.CFrame = AvailableSpawnPoints[1].CFrame
					table.remove(AvailableSpawnPoints,1)
					table.remove(plrs,i)
					i -= 1
					game.ReplicatedStorage.WaitScreenEnd:FireClient(player)
				end
				
			end
		end
	end
	
	
	full = false
	
end

which value teleports them???

sorry im so tired

1 Like

https://youtu.be/ESzmiC_AzLw thedevking has when you die you teleport somewhere

you can try a team spawn so when you get teleported you get into a team

What do you mean which value teleports them?