Respawn Function Help

Hey, I am Galactiq and I have been scripting for nearly four years now! I have encountered a problem with a bit of my code. Essentially, I am creating custom obby code. Whenever the player’s character loads, it is to teleport the player to the correct spawn point. However, this is not working. There is no error, either. I would appreciate any help or suggestions. Thanks!

My code:

Player.CharacterAdded:connect(function(Character)
		wait()
		Character:MoveTo(Stages:WaitForChild(tostring(_G.PlayerData[Player.UserId]["Stage"])).Position + Vector3.new(0,3,0))
		
		SetCollisionGroupRecursive(Character)
		
		Character.DescendantAdded:connect(SetCollisionGroup)
		Character.DescendantRemoving:connect(ResetCollisionGroup)
		
		Character:WaitForChild("Humanoid").Died:connect(function()
			if InstantRespawn then
				Player:LoadCharacter()
			end
		end)
	end)
2 Likes

I have attempted :MoveTo() as well as :SetPrimaryPartCFrame()

It’s a local script or script ? @Galactiq

It is a Server side script. However, I tried the same with a local script. Neither worked.

Use teams and set spawnpoint for a team
That’s be spawning player if i in team Example Stage 2
Then set spawpoint color to Stage 2 color

Okay but that is not the approach I am going for. I do not want to have to create a separate team object for each individual level. As of now, the place is just to test the mechanics of the game. However, if I were to apply it to like a 100 level obby, then there would be an overload of team objects. Which I do not exactly prefer.

Just use Player.RespawnLocation

Have you tried using the HumanoidRootPart instead of :MoveTo()?