Client believes the character is the character it had prior to dying

Upon respawning (but not necessarily respawning), I want the client to access its character. The server controls when the client does this by firing a remote event. For now it is simply when the character is added. The issue is that if the client reset, upon respawning, once the remote event fire is received, the client believes its character is the character it had before dying. Code:

--server
game.Players.PlayerAdded:Connect(function(plr) 
	plr.CharacterAdded:Connect(function(char)
		game.ReplicatedStorage.RemoteEvent:FireClient(plr)
	end)
end)

--client
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(data)
	if (game.Players.LocalPlayer.Character == nil) then
		game.Players.LocalPlayer.CharacterAdded:wait()
	end
	print(game.Players.LocalPlayer.Character:GetChildren())
end)

I have included a video that shows how when the children of the character is printed locally, after the character spawns in, it includes an instance that I added to the character before it died.

I’d like for the client to recognize its new character after respawning rather than referencing its old one. Any help would be appreciated.

I think I understand what’s happening. The local script is running before the character is destroyed (on the client) So when the client runs, game.Players.LocalPlayer.Character is equal to the old character because it’s still getting destroyed. So what you should do is check to see if game.Players.LocalPlayer.Character is equal to the old character, and if so, wait for the new one to spawn.

Here’s an example of the server and client scripts:

--server
local remote = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		remote:FireClient(plr)
	end)
end)


--client
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local remote = game.ReplicatedStorage.RemoteEvent
local lastChar = nil

function getChildren()
	local char = player.Character
	if not char or char == lastChar then char = player.CharacterAdded:Wait() end
	lastChar = char
	RunService.Heartbeat:Wait()
	local children = char:GetChildren()
end

remote.OnClientEvent:Connect(getchildren)

I tested is a little and I think it works the way you’re hoping for. If not, let me know.