I need to make sure that the name of the part being deleted is taken from the player's ID

I need to make sure that the name of the part being deleted is taken from the player’s ID, but in the script that I wrote, the variable is perceived as part of the path and this is logical, but I do not know how to do it differently.

game.Players.PlayerRemoving:Connect(function(player)
	local nd = player.CharacterAppearanceId
	game.Workspace.PlayersInfo.nd:Destroy()
	print("Infopart delite: "..player.UserId, player.Name)
end)

If you know how to do this, please tell me.
I apologize if it is written strangely or incorrectly. I use a translator because I don’t know English.

1 Like

change this to

workspace.PlayersInfo[tostring(nd)]:Destroy()

or

workspace.PlayersInfo:FindFirstChild(tostring(nd)):Destroy()
1 Like