How do you make a custom SpawnLocation? (MeshPart)

The title says it all, I have a MeshPart and I want it to be the SpawnLocation for players when they join the game, how do I make that possible? (as I will have a multiple amount of the same MeshPart SpawnLocations in my game)

Can’t you just put a spawn location inside the mesh part that you want and make it invisible / non collidable?

1 Like

You can listen to when the player’s character is loaded into the game. Upon loading, set their position to the MeshPart position.

2 Likes

Like Haystees said, you can just put a spawn location inside the mesh part, but if you want to do it manually:

(It’s a server side script.)

local Players = game:GetService("Players")

local SpawnLocation = workspace:WaitForChild("CustomSpawnPoint") -- Put here your spawn location
Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		task.wait(1)
		char.HumanoidRootPart.Position = SpawnLocation.Position + Vector3.new(0,4,0)
	end)
end)

Don’t use .Position use .CFrame or Character:PivotTo(cf) else the HRP will bug

You’re right, I’m sorry for the incovencience. Here’s the updated version:

local Players = game:GetService("Players")

local SpawnLocation = workspace:WaitForChild("CustomSpawnPoint") -- Put here your spawn location
Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		task.wait(1)
		char.HumanoidRootPart.CFrame = SpawnLocation.CFrame + CFrame.new(Vector3.new(0,4,0))
	end)
end)

SpawnLocation.CFrame + Vector3.new(0,4,0) You can’t add two CFrames
But I think he got it