Custom spawn point issue

Im in the midst of creating an obby and me and a few of my scripters are having the same issue. Players have different loading times than other players which is causing errors when spawning them at there saved spawn point. To elaborate, the stages save and we need the player HumanoidRootPart as soon as they join. We have used the CharacterAdded event but that only fires when a character instance/model is added. No children are necessarily loaded. We have tried the CharacterAppearenceLoaded event but that takes to long and it wont fire even if 1 texture of a character hasn’t loaded. As you can understand this is probably very unreliable. We may have finally made a break through and found something that might work. Is this code reliable and can it facilitate the needs of lower end devices?

	task.wait(5)
	local Character = Player.Character
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart",50)
	if HumanoidRootPart then
print("Found HRP")
		Player.Character:FindFirstChild("Humanoid").UseJumpPower = true
		HumanoidRootPart.CFrame = Stages[tostring(Stage.Value)].CFrame * CFrame.new(0,3,0)
		if Stages[tostring(Stage.Value)].Name == "10" then
			Player.Character:FindFirstChild("Humanoid").Sit = true
		end
	end
	Player.CharacterAdded:Connect(function(Char)
		local HumanoidRootPart = Char:WaitForChild("HumanoidRootPart",50)
		if HumanoidRootPart then
print("Found HRP")
1 Like

Sorry, what is your question? Can you reword it?

I don’t understand what your goal is with this code. You get the player character after waiting 5 seconds, and then also connect to CharacterAdded?

Usually the pattern to use a player’s character is something like this:

-- no wait at the start, it's not necessary
local player = game.Players.LocalPlayer

local function OnCharacterAdded(character)
  local root = character:WaitForChild("HumanoidRootPart", 50)
  -- etc.
end

-- fire once just in case the character is already loaded
local characer = player.Character
if character then OnCharacterAdded(character) end

-- fire again when the character respawns
player.CharacterAdded:Connect(OnCharacterAdded)

This sort of justifies my answer. My goal was to find a good way to get the player HumanoidRootPart when it loads in. If this is what you recommend then we will use it! Thanks