[UNSOLVED] Weird character issue

I am using char = player.Character or player.CharacterAdded:Wait()
But for some reason it doesnt work.

Here is the relevant part of the code

game.Players.PlayerAdded:Connect(function(player)
	
	player:LoadCharacter()
	local plChar = Instance.new("ObjectValue")
	plChar.Name = "PlCharacter"
	plChar.Value = player.Character or player.CharacterAdded:Wait()
	plChar.Parent = game.ServerStorage
	plChar.Value:WaitForChild("Humanoid").Died:Connect(function()
		plChar.Value:Remove()
		game.Workspace.StartSpawn.Position = game.Workspace.EndRoom.SpawPos.Position
		task.wait(3)
		player:LoadCharacter()
		plChar.Value = player.Character or player.CharacterAdded:Wait()
		game.ReplicatedStorage.SoundEvent:FireClient(player, false)
		plChar.Value:WaitForChild("Humanoid").Died:Connect(function()
			print("Final Death")
		end)
	end)
	
end)
print("Starting")
task.wait(5)

local char = game.ServerStorage:WaitForChild("PlCharacter").Value
print(char.Name)

local pl = game.Players:GetPlayerFromCharacter(char)
print(pl.Name)

It brings up different errors at random. One error is that It says print(char.Name) is nil, and when I look in the explorer, PlCharacter.Value is also nil for some reason.
Sometimes it PlCharacter.Value sets to the character, but then it says that print(pl.Name) is nil, so it now for some reason cant get the player from the character.

Honestly have no Idea why this is happening.

What console saying?
Use F9 or /console
So we may know what error is.

is this in a local or server script? playeradded(player) wont work in a local if your getting the char from (player)

I already mentioned the errors of the output in my post

It is of course in a server sided script under serverscriptservice

this is prob why, but why are you using player.character in a playeradded? use player.CharacterAdded:Connect(function(char)

This is prob why because what?
I am using it in playeradded, because you need to have the player to do player.CharacterAdded. You can’t do it without a player variable

prob why you cant solve this???

cool now try this