My code works fine when I reset the character but not when character jumps and dies due to Destroy Height.
Below code gives HumanoidRootPart as output when I reset and it keeps giving nil when character dies due to fallen parts destroy height.
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
local H
repeat H = character.PrimaryPart print(H) wait() until H~= nil
if Stage.Value ~= 0 then
H.CFrame = workspace.Obby.Checkpoints[Stage.Value].PrimaryPart.CFrame + Vector3.new(0,20,0)
end
end)
end)