Attempt to index nil with parent

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Character.Humanoid.Died:Connect(function(hit)
			local cln = Character:Clone()
			cln.Parent = workspace
			Character:Remove()
			game.Debris:AddItem(cln,10)
		end)
	end)
end)

image

line 5

			cln.Parent = workspace

To clone a Character, you need to set its Archivable property to true first.

Therefore, the revised version of your code would be:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Character.Humanoid.Died:Connect(function(hit)
			Character.Archivable = true
			local cln = Character:Clone()
			cln.Parent = workspace
			Character:Remove()
			game.Debris:AddItem(cln,10)
		end)
	end)
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.